pythonasyncioapiasyncfastapiframeworkjsonjson-schemaopenapiopenapi3pydanticpython-typespython3redocreststarletteswaggerswagger-uiuvicornweb
17 lines
341 B
17 lines
341 B
from typing import Union
|
|
|
|
from fastapi import Cookie, FastAPI
|
|
from pydantic import BaseModel
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
class Cookies(BaseModel):
|
|
session_id: str
|
|
fatebook_tracker: Union[str, None] = None
|
|
googall_tracker: Union[str, None] = None
|
|
|
|
|
|
@app.get("/items/")
|
|
async def read_items(cookies: Cookies = Cookie()):
|
|
return cookies
|
|
|