feat(app): add html weather view

This commit is contained in:
2024-07-25 15:51:27 +03:00
parent 234a2b7b0e
commit b3d88997eb
22 changed files with 393 additions and 34 deletions

View File

@@ -1,26 +1,17 @@
import locale
from os import environ
import uvicorn
from fastapi import FastAPI
from gismeteo import custom_doc
from gismeteo.api import GismeteoApi
from gismeteo.route import api, doc, view
locale.setlocale(locale.LC_TIME, "ru_RU.UTF-8")
app = FastAPI(docs_url=None, redoc_url=None)
custom_doc.apply(app)
@app.get("/")
async def root():
return {}
@app.get("/weather/{location_id}")
async def get_weather(location_id: str):
api = GismeteoApi()
result = await api.today(location_id)
return [item._asdict() for item in result]
doc.mount(app)
api.mount(app)
view.mount(app)
def run():