🚚 Re-order tutorial Python fiels

This commit is contained in:
Sebastián Ramírez
2018-12-14 10:07:07 +04:00
parent ec7bec32ba
commit 400a4a99af
35 changed files with 311 additions and 322 deletions

View File

@@ -1,20 +1,8 @@
from typing import Set
from fastapi import FastAPI
from pydantic import BaseModel
from starlette.status import HTTP_201_CREATED
from fastapi import FastAPI, File, Form
app = FastAPI()
class Item(BaseModel):
name: str
description: str = None
price: float
tax: float = None
tags: Set[str] = []
@app.post("/items/", response_model=Item, status_code=HTTP_201_CREATED)
async def create_item(*, item: Item):
return item
@app.post("/files/")
async def create_file(*, file: bytes = File(...), token: str = Form(...)):
return {"file_size": len(file), "token": token}