- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 13 for pos1 (0.27 sec)
-
docs_src/generate_clients/tutorial001.py
from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str price: float class ResponseMessage(BaseModel): message: str @app.post("/items/", response_model=ResponseMessage) async def create_item(item: Item): return {"message": "item received"} @app.get("/items/", response_model=List[Item]) async def get_items(): return [
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 04 22:02:18 GMT 2022 - 519 bytes - Viewed (0) -
docs_src/openapi_callbacks/tutorial001.py
class InvoiceEventReceived(BaseModel): ok: bool invoices_callback_router = APIRouter() @invoices_callback_router.post( "{$callback_url}/invoices/{$request.body.id}", response_model=InvoiceEventReceived ) def invoice_notification(body: InvoiceEvent): pass @app.post("/invoices/", callbacks=invoices_callback_router.routes) def create_invoice(invoice: Invoice, callback_url: Union[HttpUrl, None] = None): """
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 1.3K bytes - Viewed (0) -
docs_src/request_forms/tutorial001.py
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 173 bytes - Viewed (0) -
docs_src/separate_openapi_schemas/tutorial001.py
from typing import List, Union from fastapi import FastAPI from pydantic import BaseModel class Item(BaseModel): name: str description: Union[str, None] = None app = FastAPI() @app.post("/items/") def create_item(item: Item): return item @app.get("/items/") def read_items() -> List[Item]: return [ Item( name="Portal Gun",
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Aug 25 19:10:22 GMT 2023 - 489 bytes - Viewed (0) -
docs_src/request_forms_and_files/tutorial001.py
from fastapi import FastAPI, File, Form, UploadFile app = FastAPI() @app.post("/files/") async def create_file( file: bytes = File(), fileb: UploadFile = File(), token: str = Form() ): return { "file_size": len(file), "token": token, "fileb_content_type": fileb.content_type,
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 317 bytes - Viewed (0) -
docs_src/response_model/tutorial001.py
app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None tags: List[str] = [] @app.post("/items/", response_model=Item) async def create_item(item: Item) -> Any: return item @app.get("/items/", response_model=List[Item]) async def read_items() -> Any: return [
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Jan 07 13:45:48 GMT 2023 - 562 bytes - Viewed (0) -
docs_src/custom_request_and_route/tutorial001.py
return await original_route_handler(request) return custom_route_handler app = FastAPI() app.router.route_class = GzipRoute @app.post("/sum") async def sum_numbers(numbers: List[int] = Body()):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 973 bytes - Viewed (0) -
docs_src/request_files/tutorial001.py
from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: bytes = File()): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: UploadFile):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 282 bytes - Viewed (0) -
docs_src/openapi_webhooks/tutorial001.py
app = FastAPI() class Subscription(BaseModel): username: str monthly_fee: float start_date: datetime @app.webhooks.post("new-subscription") def new_subscription(body: Subscription): """ When a new user subscribes to your service we'll send you a POST request with this data to the URL that you register for the event `new-subscription` in the dashboard. """ @app.get("/users/")
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Oct 20 09:00:44 GMT 2023 - 550 bytes - Viewed (0) -
docs_src/dataclasses/tutorial001.py
from fastapi import FastAPI @dataclass class Item: name: str price: float description: Union[str, None] = None tax: Union[float, None] = None app = FastAPI() @app.post("/items/") async def create_item(item: Item):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 312 bytes - Viewed (0)