A Python3 Flask front-end application to search the Cycle Babac catalogue and return description, price and availability.
- Clone the repository
git clone https://github.com/normcyr/flask_babac
- Create a Python virtual environment using
virtualenv
cd flask_babac
virtualenv -p python3 venv
source venv/bin/activate
- Install the module
pip install -e .
- Connection to the Cycle Babac website
cp config.yml.example config.yml
Then edit the config.yml
file (eg nano config.yml
) and change the value of the username
and password
variables to the proper credentials to log in to the Cycle Babac website.
Finally, move the config.yml
file to your user configuration folder
mkdir -p ~/.config/flask_babac
mv config.yml ~/.config/flask_babac/config.yml
- Environment variables for the Flask application
cp .env.example .env
Then edit the .env
file (eg nano .env
) and change the values of the variables to your desired parameters.
- Launch the Flask application
flask run
Then access web application at the address given, typically
http://127.0.0.1:8080
This is the page you should get at first:
And after search for training wheels
, you get your results in a table:
Launch the search with the following command:
flask_babac search text
For example:
flask_babac training wheels
or, using a catalogue number:
flask_babac 22-150
It is possible to use the JSON endpoint to search for a single SKU.
For example:
curl http://127.0.0.1:8080/json/22-168
which will return
{
"name": "Training Wheels",
"page url": "https://cyclebabac.com/product/stabilizer-12-20/",
"price": "10.00",
"rebate": "False",
"sku": "22-168",
"stock": "Yes"
}