LosKeeper / api-menu-crous

App used to create an API for many Crous restaurants in Strasbourg.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

icon API Menu Crous

Github Version Github License Github Last Commit Github Issues

Python Version

Author

This app is used to create an API for many Crous restaurants in Strasbourg.

🧾 Table of Contents

  1. πŸ‹ Docker
  2. πŸ”§ Normal Setup with Python
  3. πŸš€ Launch with Python
  4. πŸ“ How to use it
  5. 🐞 Bugs and TODO

πŸ‹ Docker

A Docker file is provided to make the installation easier. You NEED to create configuration file name .env (you can use the .env.example file as a template) :

# URL of the API
HOST=0.0.0.0

# URL of the ILLKIRCH menu website
ILLKIRCH=

# URL of the CRONENBOURG menu website
CRONENBOURG=

# URL of the PAUL APPELL menu website
PAUL_APPELL=

# URL of the Esplanade menu website
ESPLANADE=

# URL of the Gallia menu website
GALLIA=

To use it, you can build the Docker image an runing it :

docker build -t api-menu-crous .
docker run -p <WANTED_PORT>:5000 --env-file .env -d api-menu-crous

Or you can use the Docker image from the Docker Hub :

docker pull ghcr.io/loskeeper/api-menu-crous-docker:latest
docker run -p <WANTED_PORT>:5000 --env-file .env -d ghcr.io/loskeeper/api-menu-crous-docker:latest

πŸ”§ Normal Setup with Python

Many libraries are needed to make this bot work :

pip install -r requirements.txt
Info

If you have some troubles with the installation of the pycurl library, make sure to have installed the libcurl4-openssl-dev and the libssl-dev packages :

sudo apt install libcurl4-openssl-dev libssl-dev

To configure the api, you need to create configuration file name .env (you can use the .env.example file as a template) :

# URL of the API
HOST=

# URL of the ILLKIRCH menu website
ILLKIRCH=

# URL of the CRONENBOURG menu website
CRONENBOURG=

# URL of the PAUL APPELL menu website
PAUL_APPELL=

# URL of the Esplanade menu website
ESPLANADE=

# URL of the Gallia menu website
GALLIA=

πŸš€ Launch with Python

To launch the bot, you need to run the main.py file :

python3 main.py

πŸ“ How to use it

To use it, you need to connect to the API URL you have configured in the .env file with the port 5000. The accessibles URL are :

  • / : Display the available routes
  • /illkirch : Display the menu of the ILLKIRCH restaurant
  • /cronenbourg : Display the menu of the CRONENBOURG restaurant
  • /paul-appell : Display the menu of the PAUL APPELL restaurant
  • /esplanade : Display the menu of the ESPLANADE restaurant
  • /gallia : Display the menu of the GALLIA restaurant

An example of the output for the /illkirch route can be find in the example.json file.

🐞 Bugs and TODO

  • Add threads to make the answer faster

About

App used to create an API for many Crous restaurants in Strasbourg.

License:GNU General Public License v3.0


Languages

Language:Python 93.8%Language:Dockerfile 6.2%