- Sort Score
- Num 10 results
- Language All
Results 291 - 300 of 909 for item01 (0.07 seconds)
-
tests/test_tutorial/test_dependencies/test_tutorial012.py
def test_get_valid_headers_items(client: TestClient): response = client.get( "/items/", headers={ "X-Token": "fake-super-secret-token", "X-Key": "fake-super-secret-key", }, ) assert response.status_code == 200, response.text assert response.json() == [{"item": "Portal Gun"}, {"item": "Plumbus"}] def test_get_valid_headers_users(client: TestClient):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 7.7K bytes - Click Count (0) -
tests/test_union_body.py
from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: Optional[str] = None class OtherItem(BaseModel): price: int @app.post("/items/") def save_union_body(item: Union[OtherItem, Item]): return {"item": item} client = TestClient(app) def test_post_other_item(): response = client.post("/items/", json={"price": 100})
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 4.3K bytes - Click Count (0) -
tests/test_tutorial/test_dependencies/test_tutorial002_tutorial003_tutorial004.py
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Dec 26 10:43:02 GMT 2025 - 6K bytes - Click Count (0) -
tests/test_tutorial/test_body/test_tutorial003.py
response = client.put( "/items/123", json={"name": "Foo", "price": 50.1}, ) assert response.status_code == 200 assert response.json() == { "item_id": 123, "name": "Foo", "price": 50.1, "description": None, "tax": None, } def test_put_with_no_data(client: TestClient): response = client.put("/items/123", json={})
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Dec 26 10:43:02 GMT 2025 - 5.5K bytes - Click Count (0) -
docs_src/handling_errors/tutorial001_py39.py
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 299 bytes - Click Count (0) -
docs_src/handling_errors/tutorial002_py39.py
app = FastAPI() items = {"foo": "The Foo Wrestlers"} @app.get("/items-header/{item_id}") async def read_item_header(item_id: str): if item_id not in items: raise HTTPException( status_code=404, detail="Item not found", headers={"X-Error": "There goes my error"}, )
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 404 bytes - Click Count (0) -
docs_src/dependencies/tutorial004_py39.py
self.q = q self.skip = skip self.limit = limit @app.get("/items/") async def read_items(commons: CommonQueryParams = Depends()): response = {} if commons.q: response.update({"q": commons.q}) items = fake_items_db[commons.skip : commons.skip + commons.limit] response.update({"items": items})Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 639 bytes - Click Count (0) -
docs_src/dependencies/tutorial004_an_py39.py
self.q = q self.skip = skip self.limit = limit @app.get("/items/") async def read_items(commons: Annotated[CommonQueryParams, Depends()]): response = {} if commons.q: response.update({"q": commons.q}) items = fake_items_db[commons.skip : commons.skip + commons.limit] response.update({"items": items})Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 660 bytes - Click Count (0) -
tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py
return {"message": "Admin Access"} router = APIRouter(dependencies=[Security(oauth2_scheme, scopes=["read"])]) @router.get("/items/") async def read_items(token: Optional[str] = Depends(oauth2_scheme)): return {"token": token} @router.post("/items/") async def create_item( token: Optional[str] = Security(oauth2_scheme, scopes=["read", "write"]), ): return {"token": token}Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 6.6K bytes - Click Count (0) -
tests/test_validation_error_context.py
raise exc @app.get("/users/{user_id}") def get_user(user_id: int): return {"user_id": user_id} # pragma: no cover @app.get("/items/", response_model=Item) def get_item(): return {"name": "Widget"} @sub_app.get("/items/", response_model=Item) def get_sub_item(): return {"name": "Widget"} # pragma: no cover @app.websocket("/ws/{item_id}")
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 06 12:21:57 GMT 2025 - 4.7K bytes - Click Count (0)