- Sort Score
- Result 10 results
- Languages All
Results 241 - 250 of 1,178 for strs (0.02 sec)
-
docs_src/path_operation_configuration/tutorial001_py39.py
from typing import Union from fastapi import FastAPI, status from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None tags: set[str] = set() @app.post("/items/", response_model=Item, status_code=status.HTTP_201_CREATED) async def create_item(item: Item):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 401 bytes - Viewed (0) -
docs_src/additional_responses/tutorial004_py39.py
from typing import Union from fastapi import FastAPI from fastapi.responses import FileResponse from pydantic import BaseModel class Item(BaseModel): id: str value: str responses = { 404: {"description": "Item not found"}, 302: {"description": "The item was moved"}, 403: {"description": "Not enough privileges"}, } app = FastAPI() @app.get( "/items/{item_id}",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 701 bytes - Viewed (0) -
tests/test_request_params/test_body/test_optional_str.py
@pytest.mark.parametrize( "path", ["/optional-str", "/model-optional-str"], ) def test_optional_str_missing_empty_dict(path: str): client = TestClient(app) response = client.post(path, json={}) assert response.status_code == 200, response.text assert response.json() == {"p": None} @pytest.mark.parametrize( "path", ["/optional-str", "/model-optional-str"], ) def test_optional_str(path: str):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 11.6K bytes - Viewed (0) -
docs_src/encoder/tutorial001_py39.py
from fastapi.encoders import jsonable_encoder from pydantic import BaseModel fake_db = {} class Item(BaseModel): title: str timestamp: datetime description: Union[str, None] = None app = FastAPI() @app.put("/items/{id}") def update_item(id: str, item: Item): json_compatible_item_data = jsonable_encoder(item)Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 461 bytes - Viewed (0) -
tests/test_request_params/test_form/test_list.py
# Without aliases @app.post("/required-list-str", operation_id="required_list_str") async def read_required_list_str(p: Annotated[list[str], Form()]): return {"p": p} class FormModelRequiredListStr(BaseModel): p: list[str] @app.post("/model-required-list-str", operation_id="model_required_list_str")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:31:34 UTC 2025 - 11.7K bytes - Viewed (0) -
docs_src/openapi_callbacks/tutorial001_py310.py
from fastapi import APIRouter, FastAPI from pydantic import BaseModel, HttpUrl app = FastAPI() class Invoice(BaseModel): id: str title: str | None = None customer: str total: float class InvoiceEvent(BaseModel): description: str paid: bool class InvoiceEventReceived(BaseModel): ok: bool invoices_callback_router = APIRouter() @invoices_callback_router.post(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 10 08:55:32 UTC 2025 - 1.3K bytes - Viewed (0) -
cmd/iam-store.go
cache.iamUsersMap = newCache.iamUsersMap // For STS policy map, we need to merge the new cache with the existing // cache because the periodic IAM reload is partial. The periodic load // here is to account for STS policy mapping changes that should apply // for service accounts derived from such STS accounts (i.e. LDAP STS // accounts). newCache.iamSTSPolicyMap.Range(func(k string, v MappedPolicy) bool {
Registered: Sun Dec 28 19:28:13 UTC 2025 - Last Modified: Sun Sep 28 20:59:21 UTC 2025 - 87.1K bytes - Viewed (0) -
docs_src/bigger_applications/app_py39/routers/items.py
@router.get("/{item_id}") async def read_item(item_id: str): if item_id not in fake_items_db: raise HTTPException(status_code=404, detail="Item not found") return {"name": fake_items_db[item_id]["name"], "item_id": item_id} @router.put( "/{item_id}", tags=["custom"], responses={403: {"description": "Operation forbidden"}}, ) async def update_item(item_id: str): if item_id != "plumbus":
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 1011 bytes - Viewed (0) -
docs_src/response_directly/tutorial001_py39.py
from fastapi.responses import JSONResponse from pydantic import BaseModel class Item(BaseModel): title: str timestamp: datetime description: Union[str, None] = None app = FastAPI() @app.put("/items/{id}") def update_item(id: str, item: Item): json_compatible_item_data = jsonable_encoder(item)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 505 bytes - Viewed (0) -
docs/pt/docs/python-types.md
```Python hl_lines="1 4" {!../../docs_src/python_types/tutorial009_py39.py!} ``` O uso de `Optional[str]` em vez de apenas `str` permitirá que o editor o ajude a detectar erros, onde você pode estar assumindo que um valor é sempre um `str`, quando na verdade também pode ser `None`. `Optional[Something]` é na verdade um atalho para `Union[Something, None]`, eles são equivalentes.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 16.7K bytes - Viewed (0)