FastApi / Uvicorn Backend deployed with EC2 / Route53
Use the FFTT (France Table Tennis Federation) Api to get Table Tennis players and their results.
Use pylint for static code analysis
Deployed with AWS EC2 here :
http://fastapifftt.thorigne-tt.net/docs
CI to lint and redeploy on push with Github secrets
- Set up a .env file with theses keys:
ID_FFTT=""
KEY_FFTT=""
MJ_APIKEY_PUBLIC=""
MJ_APIKEY_PRIVATE=""
- Install dependencies :
pip install -r requirements.txt
- Run app in dev mode :
uvicorn src.main:app --reload
- Run a redis container with a redis insight container :
docker compose up
Redis is now on localhost:6379 and redis insight on localhost:8001
- Build the Docker image :
docker build . -t fastapi_fftt
- Run the Docker Image to deploy it on port 80 :
docker run -d -p 80:8000 fastapi_fftt
Script Python (in use_cases folder) :
- Get victories of a player :
res = requests.get("http://fastapifftt.thorigne-tt.net/matches/3524012",timeout=60)
for match in res.json():
if match['victoire'] == 'V':
print(f"{match['nom']} : {match['classement']} points")
- Get ProA Stats :
res = requests.get("http://fastapifftt.thorigne-tt.net/matches/proA", timeout=60)
for player in res.json():
print(f'{player[0]} : {player[1]["vict"]}/{player[1]["matches"]} ' \
f'({player[1]["win_ratio"]:.2f}%)')