Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 132 for could (0.26 sec)

  1. docs_src/security/tutorial004.py

        return encoded_jwt
    
    
    async def get_current_user(token: str = Depends(oauth2_scheme)):
        credentials_exception = HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Could not validate credentials",
            headers={"WWW-Authenticate": "Bearer"},
        )
        try:
            payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
            username: str = payload.get("sub")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
  2. docs_src/security/tutorial004_an.py

        return encoded_jwt
    
    
    async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
        credentials_exception = HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Could not validate credentials",
            headers={"WWW-Authenticate": "Bearer"},
        )
        try:
            payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
            username: str = payload.get("sub")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  3. docs/en/docs/advanced/dataclasses.md

    9. This *path operation function* is not returning dataclasses (although it could), but a list of dictionaries with internal data.
    
        FastAPI will use the `response_model` parameter (that includes dataclasses) to convert the response.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  4. docs/en/docs/advanced/middleware.md

    ## Integrated middlewares
    
    **FastAPI** includes several middlewares for common use cases, we'll see next how to use them.
    
    !!! note "Technical Details"
        For the next examples, you could also use `from starlette.middleware.something import SomethingMiddleware`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 10 18:27:10 GMT 2023
    - 4K bytes
    - Viewed (0)
  5. docs/en/docs/python-types.md

        ```Python hl_lines="1  4"
        {!> ../../../docs_src/python_types/tutorial008b.py!}
        ```
    
    In both cases this means that `item` could be an `int` or a `str`.
    
    #### Possibly `None`
    
    You can declare that a value could have a type, like `str`, but that it could also be `None`.
    
    In Python 3.6 and above (including Python 3.10) you can declare it by importing and using `Optional` from the `typing` module.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_security/test_tutorial005_py39.py

    @needs_py39
    def test_incorrect_token(client: TestClient):
        response = client.get("/users/me", headers={"Authorization": "Bearer nonexistent"})
        assert response.status_code == 401, response.text
        assert response.json() == {"detail": "Could not validate credentials"}
        assert response.headers["WWW-Authenticate"] == 'Bearer scope="me"'
    
    
    @needs_py39
    def test_incorrect_token_type(client: TestClient):
        response = client.get(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.3K bytes
    - Viewed (0)
  7. docs/en/docs/contributing.md

        This makes sure that if you use a terminal program installed by that package, you use the one from your local environment and not any other that could be installed globally.
    
    ### Install requirements using pip
    
    After activating the environment as described above:
    
    <div class="termy">
    
    ```console
    $ pip install -r requirements.txt
    
    ---> 100%
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 17:42:43 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/using-request-directly.md

    It would also mean that if you get data from the `Request` object directly (for example, read the body) it won't be validated, converted or documented (with OpenAPI, for the automatic API user interface) by FastAPI.
    
    Although any other parameter declared normally (for example, the body with a Pydantic model) would still be validated, converted, annotated, etc.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Aug 29 14:02:58 GMT 2020
    - 2.3K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/bigger-applications.md

    ### Import `APIRouter`
    
    You import it and create an "instance" the same way you would with the class `FastAPI`:
    
    ```Python hl_lines="1  3" title="app/routers/users.py"
    {!../../../docs_src/bigger_applications/app/routers/users.py!}
    ```
    
    ### *Path operations* with `APIRouter`
    
    And then you use it to declare your *path operations*.
    
    Use it the same way you would use the `FastAPI` class:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  10. docs/en/docs/advanced/sub-applications.md

    That way, the sub-application will know to use that path prefix for the docs UI.
    
    And the sub-application could also have its own mounted sub-applications and everything would work correctly, because FastAPI handles all these `root_path`s automatically.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 2.9K bytes
    - Viewed (0)
Back to top