- Sort Score
- Result 10 results
- Languages All
Results 371 - 380 of 1,074 for Str (0.01 sec)
-
docs/pt/docs/tutorial/encoder.md
``` //// Neste exemplo, ele converteria o modelo Pydantic em um `dict`, e o `datetime` em um `str`. O resultado de chamar a função é algo que pode ser codificado com o padrão do Python <a href="https://docs.python.org/3/library/json.html#json.dumps" class="external-link" target="_blank">`json.dumps()`</a>.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 1.9K bytes - Viewed (0) -
docs/es/docs/tutorial/query-params.md
/// /// note | Nota FastAPI sabrá que `q` es opcional por el `= None`. El `Union` en `Union[str, None]` no es usado por FastAPI (FastAPI solo usará la parte `str`), pero el `Union[str, None]` le permitirá a tu editor ayudarte a encontrar errores en tu código. /// ## Conversión de tipos de parámetros de query
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5.1K bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial004_py310.py
from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Item = Body( examples=[ { "name": "Foo", "description": "A very nice Item",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Jul 01 16:43:29 UTC 2023 - 786 bytes - Viewed (0) -
tests/test_additional_responses_custom_validationerror.py
from pydantic import BaseModel app = FastAPI() class JsonApiResponse(JSONResponse): media_type = "application/vnd.api+json" class Error(BaseModel): status: str title: str class JsonApiError(BaseModel): errors: typing.List[Error] @app.get( "/a/{id}", response_class=JsonApiResponse, responses={422: {"description": "Error", "model": JsonApiError}},
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.9K bytes - Viewed (0) -
tests/test_security_api_key_header_optional.py
from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() api_key = APIKeyHeader(name="key", auto_error=False) class User(BaseModel): username: str def get_current_user(oauth_header: Optional[str] = Security(api_key)): if oauth_header is None: return None user = User(username=oauth_header) return user @app.get("/users/me")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2K bytes - Viewed (0) -
docs_src/dependency_testing/tutorial001_an.py
from typing import Union from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from typing_extensions import Annotated app = FastAPI() async def common_parameters( q: Union[str, None] = None, skip: int = 0, limit: int = 100 ): return {"q": q, "skip": skip, "limit": limit} @app.get("/items/") async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 1.5K bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial002_py310.py
from fastapi import FastAPI from pydantic import BaseModel, Field app = FastAPI() class Item(BaseModel): name: str = Field(examples=["Foo"]) description: str | None = Field(default=None, examples=["A very nice Item"]) price: float = Field(examples=[35.4]) tax: float | None = Field(default=None, examples=[3.2]) @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 479 bytes - Viewed (0) -
docs_src/body_multiple_params/tutorial003.py
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 class User(BaseModel): username: str full_name: Union[str, None] = None @app.put("/items/{item_id}") async def update_item(item_id: int, item: Item, user: User, importance: int = Body()):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 548 bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial004_an_py310.py
from typing import Annotated from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Annotated[ Item, Body( examples=[ {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Jul 01 16:43:29 UTC 2023 - 917 bytes - Viewed (0) -
docs_src/background_tasks/tutorial002_py310.py
from fastapi import BackgroundTasks, Depends, FastAPI app = FastAPI() def write_log(message: str): with open("log.txt", mode="a") as log: log.write(message) def get_query(background_tasks: BackgroundTasks, q: str | None = None): if q: message = f"found query: {q}\n" background_tasks.add_task(write_log, message) return q @app.post("/send-notification/{email}")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jan 07 14:11:31 UTC 2022 - 643 bytes - Viewed (0)