Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 35 for Leider (0.16 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. 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. 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)
  7. 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)
  8. scripts/docs.py

        frontmatter_end = match_pre.end()
        pre_end = match_start.end()
        post_start = match_end.start()
        template = Template(index_sponsors_template)
        message = template.render(sponsors=sponsors)
        pre_content = content[frontmatter_end:pre_end]
        post_content = content[post_start:]
        new_content = pre_content + message + post_content
        return new_content
    
    
    @app.command()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Mon Jan 22 19:26:14 GMT 2024
    - 10.9K bytes
    - Viewed (1)
  9. 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)
  10. docs_src/app_testing/app_b/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)
Back to top