14 lines
364 B
Python
14 lines
364 B
Python
import datetime
|
|
|
|
from fastapi import FastAPI, Request
|
|
|
|
from weather.model import WeatherResponse
|
|
|
|
|
|
def mount(app: FastAPI):
|
|
@app.get("/api/weather/{location}/{date}")
|
|
async def get_weather_api(
|
|
request: Request, location: str, date: datetime.date
|
|
) -> WeatherResponse:
|
|
return await request.app.state.weather_api.get_day(location, date)
|