📝 Add first tutorial src files

This commit is contained in:
Sebastián Ramírez
2018-12-13 21:05:15 +04:00
parent 948a39af95
commit 7da0233e35
68 changed files with 1404 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
from fastapi import Body, FastAPI, Path, Query
from pydantic import BaseModel
from typing import Set
app = FastAPI()
class Image(BaseModel):
url: str
name: str
class Item(BaseModel):
name: str
description: str = None
price: float
tax: float = None
tags: Set[str] = []
image: Image = None
@app.put("/items/{item_id}")
async def update_item(
*,
item_id: int,
item: Item,
):
results = {"item_id": item_id, "item": item}
return results