- Sort Score
- Result 10 results
- Languages All
Results 331 - 340 of 1,078 for nine (0.02 sec)
-
docs_src/body_fields/tutorial001_py310.py
from pydantic import BaseModel, Field app = FastAPI() class Item(BaseModel): name: str description: str | None = Field( default=None, title="The description of the item", max_length=300 ) price: float = Field(gt=0, description="The price must be greater than zero") tax: float | None = None @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item = Body(embed=True)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 523 bytes - Viewed (0) -
docs_src/response_model/tutorial001_py39.py
from typing import Any, Union from fastapi import FastAPI from pydantic import BaseModel 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])
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Jan 07 13:45:48 UTC 2023 - 556 bytes - Viewed (0) -
docs/en/docs/deployment/docker.md
from fastapi import FastAPI app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Union[str, None] = None): return {"item_id": item_id, "q": q} ``` ### Dockerfile Now in the same project directory create a file `Dockerfile` with: ```{ .dockerfile .annotate } # (1)! FROM python:3.9
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Sep 18 16:09:57 UTC 2024 - 28.5K bytes - Viewed (0) -
docs_src/body_fields/tutorial001.py
app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = Field( default=None, title="The description of the item", max_length=300 ) price: float = Field(gt=0, description="The price must be greater than zero") tax: Union[float, None] = None @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item = Body(embed=True)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 561 bytes - Viewed (0) -
docs_src/additional_status_codes/tutorial001_an_py39.py
items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}} @app.put("/items/{item_id}") async def upsert_item( item_id: str, name: Annotated[Union[str, None], Body()] = None, size: Annotated[Union[int, None], Body()] = None, ): if item_id in items: item = items[item_id] item["name"] = name item["size"] = size return item else:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 705 bytes - Viewed (0) -
docs_src/body_fields/tutorial001_an.py
app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = Field( default=None, title="The description of the item", max_length=300 ) price: float = Field(gt=0, description="The price must be greater than zero") tax: Union[float, None] = None @app.put("/items/{item_id}") async def update_item(item_id: int, item: Annotated[Item, Body(embed=True)]):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 611 bytes - Viewed (0) -
docs_src/additional_status_codes/tutorial001_an.py
items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}} @app.put("/items/{item_id}") async def upsert_item( item_id: str, name: Annotated[Union[str, None], Body()] = None, size: Annotated[Union[int, None], Body()] = None, ): if item_id in items: item = items[item_id] item["name"] = name item["size"] = size return item else:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 734 bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial005_an_py39.py
from typing import Annotated, Union from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Annotated[ Item, Body( openapi_examples={
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Aug 26 18:03:13 UTC 2023 - 1.5K bytes - Viewed (0) -
test-site/public/javascripts/suggestor.js
Registered: Fri Nov 08 09:08:12 UTC 2024 - Last Modified: Mon Apr 20 08:41:37 UTC 2015 - 14.6K bytes - Viewed (0) -
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001_py310.py
return client @needs_py310 def test_create_item(client: TestClient) -> None: response = client.post("/items/", json={"name": "Foo"}) assert response.status_code == 200, response.text assert response.json() == {"name": "Foo", "description": None} @needs_py310 def test_read_items(client: TestClient) -> None: response = client.get("/items/") assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Sep 28 04:14:40 UTC 2023 - 4.9K bytes - Viewed (0)