Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 31 for Leider (0.18 sec)

  1. docs_src/header_params/tutorial002_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, Header
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        strange_header: Annotated[str | None, Header(convert_underscores=False)] = None,
    ):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 261 bytes
    - Viewed (0)
  2. fastapi/__init__.py

    from .param_functions import Cookie as Cookie
    from .param_functions import Depends as Depends
    from .param_functions import File as File
    from .param_functions import Form as Form
    from .param_functions import Header as Header
    from .param_functions import Path as Path
    from .param_functions import Query as Query
    from .param_functions import Security as Security
    from .requests import Request as Request
    from .responses import Response as Response
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:31:47 GMT 2024
    - 1.1K bytes
    - Viewed (0)
  3. tests/test_security_oauth2_optional.py

            }
        },
        auto_error=False,
    )
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: Optional[str] = Security(reusable_oauth2)):
        if oauth_header is None:
            return None
        user = User(username=oauth_header)
        return user
    
    
    @app.post("/login")
    def login(form_data: OAuth2PasswordRequestFormStrict = Depends()):
        return form_data
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  4. docs_src/app_testing/app_b/test_main.py

        }
    
    
    def test_read_item_bad_token():
        response = client.get("/items/foo", headers={"X-Token": "hailhydra"})
        assert response.status_code == 400
        assert response.json() == {"detail": "Invalid X-Token header"}
    
    
    def test_read_nonexistent_item():
        response = client.get("/items/baz", headers={"X-Token": "coneofsilence"})
        assert response.status_code == 404
        assert response.json() == {"detail": "Item not found"}
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  5. 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)
  6. fastapi/dependencies/utils.py

            dependant.query_params, request.query_params
        )
        header_values, header_errors = request_params_to_args(
            dependant.header_params, request.headers
        )
        cookie_values, cookie_errors = request_params_to_args(
            dependant.cookie_params, request.cookies
        )
        values.update(path_values)
        values.update(query_values)
        values.update(header_values)
        values.update(cookie_values)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_dependencies/test_tutorial012_an.py

    
    def test_get_invalid_second_header_items():
        response = client.get(
            "/items/", headers={"X-Token": "fake-super-secret-token", "X-Key": "invalid"}
        )
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "X-Key header invalid"}
    
    
    def test_get_invalid_second_header_users():
        response = client.get(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_bigger_applications/test_main_an.py

        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    def test_items_bar_with_invalid_token(client: TestClient):
        response = client.get("/items/bar?token=jessica", headers={"X-Token": "invalid"})
        assert response.status_code == 400
        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    def test_items_with_missing_x_token_header(client: TestClient):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.6K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_bigger_applications/test_main_an_py39.py

        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    @needs_py39
    def test_items_bar_with_invalid_token(client: TestClient):
        response = client.get("/items/bar?token=jessica", headers={"X-Token": "invalid"})
        assert response.status_code == 400
        assert response.json() == {"detail": "X-Token header invalid"}
    
    
    @needs_py39
    def test_items_with_missing_x_token_header(client: TestClient):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 24.9K bytes
    - Viewed (0)
  10. fastapi/security/http.py

        `HTTPDigest` in a dependency.
    
        The HTTP authorization header value is split by the first space.
    
        The first part is the `scheme`, the second part is the `credentials`.
    
        For example, in an HTTP Bearer token scheme, the client will send a header
        like:
    
        ```
        Authorization: Bearer deadbeef12346
        ```
    
        In this case:
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 15:29:38 GMT 2024
    - 13.2K bytes
    - Viewed (0)
Back to top