Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 51 for We (0.16 sec)

  1. docs/en/docs/tutorial/sql-databases.md

    Each instance of the `SessionLocal` class will be a database session. The class itself is not a database session yet.
    
    But once we create an instance of the `SessionLocal` class, this instance will be the actual database session.
    
    We name it `SessionLocal` to distinguish it from the `Session` we are importing from SQLAlchemy.
    
    We will use `Session` (the one imported from SQLAlchemy) later.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 29.6K bytes
    - Viewed (0)
  2. docs/en/docs/advanced/settings.md

        If not provided, it's `None` by default, here we provide `"World"` as the default value to use.
    
    Then you could call that Python program:
    
    <div class="termy">
    
    ```console
    // Here we don't set the env var yet
    $ python main.py
    
    // As we didn't set the env var, we get the default value
    
    Hello World from Python
    
    // But if we create an environment variable first
    $ export MY_NAME="Wade Wilson"
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 15.7K bytes
    - Viewed (0)
  3. docs/en/docs/advanced/events.md

    In our code example above, we don't use it directly, but we pass it to FastAPI for it to use it.
    
    The `lifespan` parameter of the `FastAPI` app takes an **async context manager**, so we can pass our new `lifespan` async context manager to it.
    
    ```Python hl_lines="22"
    {!../../../docs_src/events/tutorial003.py!}
    ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/dependencies/classes-as-dependencies.md

        ```Python hl_lines="11"
        {!> ../../../docs_src/dependencies/tutorial001.py!}
        ```
    
    But then we get a `dict` in the parameter `commons` of the *path operation function*.
    
    And we know that editors can't provide a lot of support (like completion) for `dict`s, because they can't know their keys and value types.
    
    We can do better...
    
    ## What makes a dependency
    
    Up to now you have seen dependencies declared as functions.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.4K bytes
    - Viewed (0)
  5. docs_src/dependencies/tutorial008c_an_py39.py

    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("Oops, we didn't raise again, Britney 😱")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
            raise InternalError(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 700 bytes
    - Viewed (0)
  6. docs/en/docs/index.md

    <div style="text-align: right; margin-right: 10%;">Kabir Khan - <strong>Microsoft</strong> <a href="https://github.com/tiangolo/fastapi/pull/26" target="_blank"><small>(ref)</small></a></div>
    
    ---
    
    "_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_"
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 19.2K bytes
    - Viewed (0)
  7. fastapi/dependencies/utils.py

                ] = fastapi_specific_annotations[-1]
            else:
                fastapi_annotation = None
            if isinstance(fastapi_annotation, FieldInfo):
                # Copy `field_info` because we mutate `field_info.default` below.
                field_info = copy_field_info(
                    field_info=fastapi_annotation, annotation=use_annotation
                )
    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. docs/he/docs/index.md

    <div style="text-align: right; margin-right: 10%;">Kabir Khan - <strong>Microsoft</strong> <a href="https://github.com/tiangolo/fastapi/pull/26" target="_blank"><small>(ref)</small></a></div>
    
    ---
    
    "_We adopted the **FastAPI** library to spawn a **REST** server that can be queried to obtain **predictions**. [for Ludwig]_"
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 21.2K bytes
    - Viewed (0)
  9. docs/fa/docs/index.md

    ---
    
    <div style="text-align: left; direction: ltr;">"We adopted the <strong>FastAPI</strong> library to spawn a <strong>REST</strong>server that can be queried to obtain <strong>predictions</strong>. [for Ludwig]"</div>
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 25.9K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

        ```Python hl_lines="13-14"
        {!> ../../../docs_src/dependencies/tutorial008c.py!}
        ```
    
    In this case, the client will see an *HTTP 500 Internal Server Error* response as it should, given that we are not raising an `HTTPException` or similar, but the server will **not have any logs** or any other indication of what was the error. 😱
    
    ### Always `raise` in Dependencies with `yield` and `except`
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 14.1K bytes
    - Viewed (0)
Back to top