- Sort Score
- Result 10 results
- Languages All
Results 261 - 270 of 1,107 for def2 (0.06 sec)
-
docs_src/dependencies/tutorial011.py
app = FastAPI() class FixedContentQueryChecker: def __init__(self, fixed_content: str): self.fixed_content = fixed_content def __call__(self, q: str = ""): if q: return self.fixed_content in q return False checker = FixedContentQueryChecker("bar") @app.get("/query-checker/") async def read_query_check(fixed_content_included: bool = Depends(checker)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 504 bytes - Viewed (0) -
docs_src/dependencies/tutorial008_an.py
from typing_extensions import Annotated async def dependency_a(): dep_a = generate_dep_a() try: yield dep_a finally: dep_a.close() async def dependency_b(dep_a: Annotated[DepA, Depends(dependency_a)]): dep_b = generate_dep_b() try: yield dep_b finally: dep_b.close(dep_a) async def dependency_c(dep_b: Annotated[DepB, Depends(dependency_b)]):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 531 bytes - Viewed (0) -
docs_src/request_files/tutorial003_an_py39.py
from fastapi.responses import HTMLResponse app = FastAPI() @app.post("/files/") async def create_files( files: Annotated[list[bytes], File(description="Multiple files as bytes")], ): return {"file_sizes": [len(file) for file in files]} @app.post("/uploadfiles/") async def create_upload_files( files: Annotated[ list[UploadFile], File(description="Multiple files as UploadFile") ],
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 952 bytes - Viewed (0) -
tests/test_tutorial/test_schema_extra_example/test_tutorial001_py310_pv1.py
from fastapi.testclient import TestClient from ...utils import needs_py310, needs_pydanticv1 @pytest.fixture(name="client") def get_client(): from docs_src.schema_extra_example.tutorial001_py310_pv1 import app client = TestClient(app) return client @needs_py310 @needs_pydanticv1 def test_post_body_example(client: TestClient): response = client.put( "/items/5", json={
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 4.5K bytes - Viewed (0) -
tests/test_tutorial/test_header_params/test_tutorial002_py310.py
200, {"strange_header": None}, ), ], ) def test(path, headers, expected_status, expected_response, client: TestClient): response = client.get(path, headers=headers) assert response.status_code == expected_status assert response.json() == expected_response @needs_py310 def test_openapi_schema(): from docs_src.header_params.tutorial002_py310 import app
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 4.2K bytes - Viewed (0) -
docs_src/dependencies/tutorial001.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)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 442 bytes - Viewed (0) -
docs_src/dependencies/tutorial001_an_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: Annotated[dict, Depends(common_parameters)]): return commons @app.get("/users/") async def read_users(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 - 473 bytes - Viewed (0) -
tests/test_tutorial/test_path_operation_configurations/test_tutorial005_py39.py
from ...utils import needs_py39, needs_pydanticv1, needs_pydanticv2 @pytest.fixture(name="client") def get_client(): from docs_src.path_operation_configuration.tutorial005_py39 import app client = TestClient(app) return client @needs_py39 def test_query_params_str_validations(client: TestClient): response = client.post("/items/", json={"name": "Foo", "price": 42})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Sep 28 04:14:40 UTC 2023 - 8.9K bytes - Viewed (0) -
docs_src/dependencies/tutorial001_02_an.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):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 495 bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial002_an_py39.py
from ...utils import needs_py39 @pytest.fixture(name="app") def get_app(): from docs_src.request_files.tutorial002_an_py39 import app return app @pytest.fixture(name="client") def get_client(app: FastAPI): client = TestClient(app) return client @needs_py39 def test_post_form_no_body(client: TestClient): response = client.post("/files/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 8.9K bytes - Viewed (0)