Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 128 for could (0.13 sec)

  1. docs/en/docs/advanced/generate-clients.md

    But for the generated client we could **modify** the OpenAPI operation IDs right before generating the clients, just to make those method names nicer and **cleaner**.
    
    We could download the OpenAPI JSON to a file `openapi.json` and then we could **remove that prefixed tag** with a script like this:
    
    === "Python"
    
        ```Python
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/testing.md

    │   └── main.py
    ```
    
    In the file `main.py` you have your **FastAPI** app:
    
    
    ```Python
    {!../../../docs_src/app_testing/main.py!}
    ```
    
    ### Testing file
    
    Then you could have a file `test_main.py` with your tests. It could live on the same Python package (the same directory with a `__init__.py` file):
    
    ``` hl_lines="5"
    .
    ├── app
    │   ├── __init__.py
    │   ├── main.py
    │   └── test_main.py
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  3. docs/en/docs/advanced/testing-database.md

    The only changes here are in the new testing file.
    
    Your normal dependency `get_db()` would return a database session.
    
    In the test, you could use a dependency override to return your *custom* database session instead of the one that would be used normally.
    
    In this example we'll create a temporary database only for the tests.
    
    ## File structure
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.5K bytes
    - Viewed (0)
  4. tests/test_compat.py

        # For coverage
        # TODO: in theory this would allow declaring types that could be lists of bytes
        # to be read from files and other types, but I'm not even sure it's a good idea
        # to support it as a first class "feature"
        assert is_bytes_sequence_annotation(Union[List[str], List[bytes]])
    
    
    def test_is_uploadfile_sequence_annotation():
        # For coverage
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  5. docs/en/docs/how-to/graphql.md

    Depending on your use case, you might prefer to use a different library, but if you asked me, I would probably suggest you try **Strawberry**.
    
    Here's a small preview of how you could integrate Strawberry with FastAPI:
    
    ```Python hl_lines="3  22  25-26"
    {!../../../docs_src/graphql/tutorial001.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 3.4K bytes
    - Viewed (0)
  6. docs/en/docs/alternatives.md

        Nevertheless, it is already being used as a "standard" by several tools. This greatly improves interoperability, as you could switch Uvicorn for any other ASGI server (like Daphne or Hypercorn), or you could add ASGI compatible tools, like `python-socketio`.
    
    !!! check "**FastAPI** uses it to"
        Handle all the core web parts. Adding features on top.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 23.2K bytes
    - Viewed (0)
  7. fastapi/security/oauth2.py

            return data
        ```
    
        Note that for OAuth2 the scope `items:read` is a single scope in an opaque string.
        You could have custom internal logic to separate it by colon caracters (`:`) or
        similar, and get the two parts `items` and `read`. Many applications do that to
        group and organize permissions, you could do it as well in your application, just
        know that that it is application specific, it's not part of the specification.
        """
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  8. docs/en/docs/tutorial/middleware.md

    !!! note "Technical Details"
        You could also use `from starlette.requests import Request`.
    
        **FastAPI** provides it as a convenience for you, the developer. But it comes directly from Starlette.
    
    ### Before and after the `response`
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 2.9K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/path-params.md

    So, the URL for that file would be something like: `/files/home/johndoe/myfile.txt`.
    
    ### OpenAPI support
    
    OpenAPI doesn't support a way to declare a *path parameter* to contain a *path* inside, as that could lead to scenarios that are difficult to test and define.
    
    Nevertheless, you can still do it in **FastAPI**, using one of the internal tools from Starlette.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_security/test_tutorial005_an.py

        }
    
    
    def test_incorrect_token():
        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"'
    
    
    def test_incorrect_token_type():
        response = client.get(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 15.4K bytes
    - Viewed (0)
Back to top