Search Options

Results per page
Sort
Preferred Languages
Advance

Results 381 - 390 of 1,127 for def2 (0.02 sec)

  1. tests/test_sub_callbacks.py

        "{$callback_url}/invoices/{$request.body.id}", response_model=InvoiceEventReceived
    )
    def invoice_notification(body: InvoiceEvent):
        pass  # pragma: nocover
    
    
    class Event(BaseModel):
        name: str
        total: float
    
    
    events_callback_router = APIRouter()
    
    
    @events_callback_router.get("{$callback_url}/events/{$request.body.title}")
    def event_callback(event: Event):
        pass  # pragma: nocover
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 13.8K bytes
    - Viewed (0)
  2. .github/actions/people/app/main.py

        return graphql_response.data.repository.discussions.edges
    
    
    def get_graphql_pr_edges(*, settings: Settings, after: Union[str, None] = None):
        data = get_graphql_response(settings=settings, query=prs_query, after=after)
        graphql_response = PRsResponse.model_validate(data)
        return graphql_response.data.repository.pullRequests.edges
    
    
    def get_graphql_sponsor_edges(*, settings: Settings, after: Union[str, None] = None):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 17 04:13:50 UTC 2024
    - 19.2K bytes
    - Viewed (0)
  3. docs_src/response_model/tutorial005_py310.py

    }
    
    
    @app.get(
        "/items/{item_id}/name",
        response_model=Item,
        response_model_include={"name", "description"},
    )
    async def read_item_name(item_id: str):
        return items[item_id]
    
    
    @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude={"tax"})
    async def read_item_public_data(item_id: str):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 816 bytes
    - Viewed (0)
  4. tests/test_tutorial/test_handling_errors/test_tutorial005.py

                    }
                ],
                "body": {"title": "towel", "size": "XL"},
            }
        )
    
    
    def test_post():
        data = {"title": "towel", "size": 5}
        response = client.post("/items/", json=data)
        assert response.status_code == 200, response.text
        assert response.json() == data
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_header_params/test_tutorial003_an_py39.py

        ],
    )
    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_py39
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 4.3K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_schema_extra_example/test_tutorial001_py310.py

    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310, needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.schema_extra_example.tutorial001_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    @needs_pydanticv2
    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.7K bytes
    - Viewed (0)
  7. docs_src/dependencies/tutorial005_py310.py

    from fastapi import Cookie, Depends, FastAPI
    
    app = FastAPI()
    
    
    def query_extractor(q: str | None = None):
        return q
    
    
    def query_or_cookie_extractor(
        q: str = Depends(query_extractor), last_query: str | None = Cookie(default=None)
    ):
        if not q:
            return last_query
        return q
    
    
    @app.get("/items/")
    async def read_query(query_or_default: str = Depends(query_or_cookie_extractor)):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 443 bytes
    - Viewed (0)
  8. docs_src/dependencies/tutorial011_an.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: Annotated[bool, Depends(checker)]):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 554 bytes
    - Viewed (0)
  9. docs_src/dependencies/tutorial005.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: str = Depends(query_extractor),
        last_query: Union[str, None] = Cookie(default=None),
    ):
        if not q:
            return last_query
        return q
    
    
    @app.get("/items/")
    async def read_query(query_or_default: str = Depends(query_or_cookie_extractor)):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 486 bytes
    - Viewed (0)
  10. docs_src/dependencies/tutorial005_an_py310.py

    from fastapi import Cookie, Depends, FastAPI
    
    app = FastAPI()
    
    
    def query_extractor(q: str | None = None):
        return q
    
    
    def query_or_cookie_extractor(
        q: Annotated[str, Depends(query_extractor)],
        last_query: Annotated[str | None, Cookie()] = None,
    ):
        if not q:
            return last_query
        return q
    
    
    @app.get("/items/")
    async def read_query(
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 510 bytes
    - Viewed (0)
Back to top