- Sort Score
- Num 10 results
- Language All
Results 141 - 150 of 1,058 for DEF (0.02 seconds)
The search processing time has exceeded the limit. The displayed results may be partial.
-
tests/test_security_openid_connect_optional.py
class User(BaseModel): username: str def get_current_user(oauth_header: Optional[str] = Security(oid)): if oauth_header is None: return None user = User(username=oauth_header) return user @app.get("/users/me") def read_current_user(current_user: Optional[User] = Depends(get_current_user)): if current_user is None:
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Fri Jun 30 18:25:16 GMT 2023 - 2.4K bytes - Click Count (0) -
tests/test_dependency_yield_except_httpexception.py
state = initial_state.copy() app = FastAPI() async def get_database(): temp_database = fake_database.copy() try: yield temp_database fake_database.update(temp_database) except HTTPException: state["except"] = True raise finally: state["finally"] = True @app.put("/invalid-user/{user_id}") def put_invalid_user(
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Mon Sep 29 03:29:38 GMT 2025 - 1.9K bytes - Click Count (0) -
tests/test_validate_response_dataclass.py
@app.get("/items/invalid", response_model=Item) def get_invalid(): return {"name": "invalid", "price": "foo"} @app.get("/items/innerinvalid", response_model=Item) def get_innerinvalid(): return {"name": "double invalid", "price": "foo", "owner_ids": ["foo", "bar"]} @app.get("/items/invalidlist", response_model=list[Item]) def get_invalidlist(): return [ {"name": "foo"},
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 1.2K bytes - Click Count (0) -
tests/test_tutorial/test_handling_errors/test_tutorial006.py
} ] } def test_get_http_error(): response = client.get("/items/3") assert response.status_code == 418, response.text assert response.json() == {"detail": "Nope! I don't like 3."} def test_get(): response = client.get("/items/2") assert response.status_code == 200, response.text assert response.json() == {"item_id": 2} def test_openapi_schema():Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 3.6K bytes - Click Count (0) -
docs_src/dependencies/tutorial001_02_an_py39.py
app = FastAPI() async def common_parameters( q: Union[str, None] = None, skip: int = 0, limit: int = 100 ): return {"q": q, "skip": skip, "limit": limit} CommonsDep = Annotated[dict, Depends(common_parameters)] @app.get("/items/") async def read_items(commons: CommonsDep): return commons @app.get("/users/") async def read_users(commons: CommonsDep):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 466 bytes - Click Count (0) -
docs_src/dependencies/tutorial001_py39.py
from fastapi import Depends, FastAPI 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: dict = Depends(common_parameters)): return commons @app.get("/users/") async def read_users(commons: dict = Depends(common_parameters)):
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Dec 17 20:41:43 GMT 2025 - 442 bytes - Click Count (0) -
docs_src/dependencies/tutorial005_an_py39.py
from fastapi import Cookie, Depends, FastAPI app = FastAPI() def query_extractor(q: Union[str, None] = None): return q def query_or_cookie_extractor( q: Annotated[str, Depends(query_extractor)], last_query: Annotated[Union[str, None], Cookie()] = None, ): if not q: return last_query return q @app.get("/items/") async def read_query(
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Tue Mar 26 16:56:53 GMT 2024 - 529 bytes - Click Count (0) -
tests/test_tutorial/test_request_form_models/test_tutorial001.py
@pytest.fixture( name="client", params=[ "tutorial001_py39", "tutorial001_an_py39", ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.request_form_models.{request.param}") client = TestClient(mod.app) return client def test_post_body_form(client: TestClient): response = client.post("/login/", data={"username": "Foo", "password": "secret"})
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 5.7K bytes - Click Count (0) -
tests/test_tutorial/test_request_forms/test_tutorial001.py
@pytest.fixture( name="client", params=[ "tutorial001_py39", "tutorial001_an_py39", ], ) def get_client(request: pytest.FixtureRequest): mod = importlib.import_module(f"docs_src.request_forms.{request.param}") client = TestClient(mod.app) return client def test_post_body_form(client: TestClient): response = client.post("/login/", data={"username": "Foo", "password": "secret"})
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Sat Dec 27 18:19:10 GMT 2025 - 5.7K bytes - Click Count (0) -
docs/pt/docs/async.md
```Python hl_lines="1" async def get_burgers(number: int): # Faz alguma coisa assíncrona para criar os hambúrgueres return burgers ``` ...ao invés de `def`: ```Python hl_lines="2" # Isso não é assíncrono def get_sequential_burgers(number: int): # Faz alguma coisa sequencial para criar os hambúrgueres
Created: Sun Dec 28 07:19:09 GMT 2025 - Last Modified: Wed Nov 12 16:23:57 GMT 2025 - 25.8K bytes - Click Count (0)