| from fastapi import FastAPI |
| from fastapi.responses import JSONResponse |
| from Instance import Instance |
| from api import LoadBalancerAPI |
| import os |
| |
| CACHE_DIR = os.getenv("CACHE_DIR") |
| TOKEN = os.getenv("TOKEN") |
| REPO = os.getenv("REPO") |
| ID = os.getenv("ID") |
| URL = os.getenv("URL") |
| LOAD_BALANCER_URL = os.getenv("LOAD_BALANCER_URL") |
|
|
| load_balancer_api = LoadBalancerAPI(base_url=LOAD_BALANCER_URL) |
| instance = Instance(id=ID, url=URL, cache_dir=CACHE_DIR, token=TOKEN, repo=REPO, load_balancer_api=load_balancer_api) |
|
|
| app = FastAPI() |
|
|
| @app.get("/") |
| async def index(): |
| return instance.version |
|
|
| @app.get("/api/get/report") |
| async def get_report(): |
| report=instance.compile_report() |
| return JSONResponse(report) |
|
|
| @app.get('/api/get/tv/store') |
| async def get_tv_store_api(): |
| """Endpoint to get the TV store JSON.""" |
| return JSONResponse(instance.TV_STORE) |
|
|
| @app.get('/api/get/film/store') |
| async def get_film_store_api(): |
| """Endpoint to get the TV store JSON.""" |
| return JSONResponse(instance.FILM_STORE) |
|
|