feat(app): add html weather view
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user