Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 117 for Leider (0.2 sec)

  1. tests/test_starlette_exception.py

    @app.get("/items/{item_id}")
    async def read_item(item_id: str):
        if item_id not in items:
            raise HTTPException(
                status_code=404,
                detail="Item not found",
                headers={"X-Error": "Some custom header"},
            )
        return {"item": items[item_id]}
    
    
    @app.get("/http-no-body-statuscode-exception")
    async def no_body_status_code_exception():
        raise HTTPException(status_code=204)
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.4K bytes
    - Viewed (0)
  2. tests/test_ws_router.py

    import functools
    
    import pytest
    from fastapi import (
        APIRouter,
        Depends,
        FastAPI,
        Header,
        WebSocket,
        WebSocketDisconnect,
        status,
    )
    from fastapi.middleware import Middleware
    from fastapi.testclient import TestClient
    
    router = APIRouter()
    prefix_router = APIRouter()
    native_prefix_route = APIRouter(prefix="/native")
    app = FastAPI()
    
    
    @app.websocket_route("/")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jun 11 19:08:14 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  3. tests/test_openapi_examples.py

    ):
        return data
    
    
    @app.get("/header_examples/")
    def header_examples(
        data: Union[str, None] = Header(
            default=None,
            examples=[
                "json_schema_header1",
                "json_schema_header2",
            ],
            openapi_examples={
                "Header One": {
                    "summary": "Header One Summary",
                    "description": "Header One Description",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 17K bytes
    - Viewed (0)
  4. docs_src/header_params/tutorial002_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import FastAPI, Header
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        strange_header: Annotated[
            Union[str, None], Header(convert_underscores=False)
        ] = None,
    ):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 288 bytes
    - Viewed (0)
  5. docs_src/app_testing/app_b_py310/main.py

    async def read_main(item_id: str, x_token: str = Header()):
        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item_id not in fake_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return fake_db[item_id]
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item, x_token: str = Header()):
        if x_token != fake_secret_token:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 09 14:44:08 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  6. docs_src/app_testing/app_b_an/main.py

        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item_id not in fake_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return fake_db[item_id]
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item, x_token: Annotated[str, Header()]):
        if x_token != fake_secret_token:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  7. fastapi/security/api_key.py

            return api_key
    
    
    class APIKeyHeader(APIKeyBase):
        """
        API key authentication using a header.
    
        This defines the name of the header that should be provided in the request with
        the API key and integrates that into the OpenAPI documentation. It extracts
        the key value sent in the header automatically and provides it as the dependency
        result. But it doesn't define how to send that key to the client.
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 23 22:29:18 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  8. tests/test_security_openid_connect_optional.py

    oid = OpenIdConnect(openIdConnectUrl="/openid", auto_error=False)
    
    
    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:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  9. fastapi/security/utils.py

    from typing import Optional, Tuple
    
    
    def get_authorization_scheme_param(
        authorization_header_value: Optional[str],
    ) -> Tuple[str, str]:
        if not authorization_header_value:
            return "", ""
        scheme, _, param = authorization_header_value.partition(" ")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Nov 13 14:26:09 GMT 2022
    - 293 bytes
    - Viewed (0)
  10. tests/test_multipart_installation.py

        with pytest.raises(RuntimeError, match=multipart_incorrect_install_error):
            app = FastAPI()
    
            @app.post("/")
            async def root(f: bytes = File()):
                return f  # pragma: nocover
    
    
    def test_incorrect_multipart_installed_multi_form(monkeypatch):
        monkeypatch.delattr("multipart.multipart.parse_options_header", raising=False)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 3.7K bytes
    - Viewed (0)
Back to top