Giter VIP home page Giter VIP logo

fastapi_fftt's Introduction

FastAPI FFTT

FastApi / Uvicorn Backend deployed with EC2 / Route53

Explanation

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

Quick Start

  • Set up a .env file with theses keys:
ID_FFTT=""
KEY_FFTT=""
MJ_APIKEY_PUBLIC=""
MJ_APIKEY_PRIVATE=""

Python

  • Install dependencies :
pip install -r requirements.txt
  • Run app in dev mode :
uvicorn src.main:app --reload

Docker

  • 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 

Use Cases :

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}%)')

fastapi_fftt's People

Contributors

theolaperrouse avatar

Watchers

 avatar

fastapi_fftt's Issues

[Internal] Use FastAPI Router

Create router folder and add some router files

from fastapi import APIRouter
router = APIRouter()

In the main.py, import theses routers :

app.include_router(router1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.