Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 28 for declaring (0.05 seconds)

  1. docs/en/docs/advanced/using-request-directly.md

    For that you need to access the request directly.
    
    {* ../../docs_src/using_request_directly/tutorial001_py39.py hl[1,7:8] *}
    
    By declaring a *path operation function* parameter with the type being the `Request` **FastAPI** will know to pass the `Request` in that parameter.
    
    /// tip
    
    Note that in this case, we are declaring a path parameter beside the request parameter.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 2.4K bytes
    - Click Count (0)
  2. tests/test_compat.py

        # 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
        # TODO: in theory this would allow declaring types that could be lists of UploadFile
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 12:54:56 GMT 2025
    - 4.2K bytes
    - Click Count (0)
  3. docs/en/docs/python-types.md

    Python has support for optional "type hints" (also called "type annotations").
    
    These **"type hints"** or annotations are a special syntax that allow declaring the <abbr title="for example: str, int, float, bool">type</abbr> of a variable.
    
    By declaring types for your variables, editors and tools can give you better support.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 15.6K bytes
    - Click Count (0)
  4. docs/en/docs/advanced/openapi-webhooks.md

    /// info
    
    The `app.webhooks` object is actually just an `APIRouter`, the same type you would use when structuring your app with multiple files.
    
    ///
    
    Notice that with webhooks you are actually not declaring a *path* (like `/items/`), the text you pass there is just an **identifier** of the webhook (the name of the event), for example in `@app.webhooks.post("new-subscription")`, the webhook name is `new-subscription`.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 2.9K bytes
    - Click Count (0)
  5. docs/en/docs/advanced/templates.md

    Also, before that, in previous versions, the `request` object was passed as part of the key-value pairs in the context for Jinja2.
    
    ///
    
    /// tip
    
    By declaring `response_class=HTMLResponse` the docs UI will be able to know that the response will be HTML.
    
    ///
    
    /// note | Technical Details
    
    You could also use `from starlette.templating import Jinja2Templates`.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 3.5K bytes
    - Click Count (0)
  6. docs/en/docs/tutorial/dependencies/sub-dependencies.md

    ## Use the dependency { #use-the-dependency }
    
    Then we can use the dependency with:
    
    {* ../../docs_src/dependencies/tutorial005_an_py310.py hl[23] *}
    
    /// info
    
    Notice that we are only declaring one dependency in the *path operation function*, the `query_or_cookie_extractor`.
    
    But **FastAPI** will know that it has to solve `query_extractor` first, to pass the results of that to `query_or_cookie_extractor` while calling it.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 3.7K bytes
    - Click Count (0)
  7. docs/en/docs/tutorial/response-status-code.md

    Changing the default { #changing-the-default }
    
    Later, in the [Advanced User Guide](../advanced/response-change-status-code.md){.internal-link target=_blank}, you will see how to return a different status code than the default you are declaring here....
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 4K bytes
    - Click Count (0)
  8. docs/en/docs/tutorial/sql-databases.md

    Because all the **fields actually change** (the type now includes `None` and they now have a default value of `None`), we need to **re-declare** them.
    
    We don't really need to inherit from `HeroBase` because we are re-declaring all the fields. I'll leave it inheriting just for consistency, but this is not necessary. It's more a matter of personal taste. 🤷
    
    The fields of `HeroUpdate` are:
    
    * `name`
    * `age`
    * `secret_name`
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Tue Dec 02 05:06:56 GMT 2025
    - 15.8K bytes
    - Click Count (0)
  9. docs/en/docs/tutorial/query-params-str-validations.md

    When we don't need to declare more validations or metadata, we can make the `q` query parameter required just by not declaring a default value, like:
    
    ```Python
    q: str
    ```
    
    instead of:
    
    ```Python
    q: str | None = None
    ```
    
    But we are now declaring it with `Query`, for example like:
    
    ```Python
    q: Annotated[str | None, Query(min_length=3)] = None
    ```
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 16.7K bytes
    - Click Count (0)
  10. docs/en/docs/advanced/additional-responses.md

    You can use this same `responses` parameter to add different media types for the same main response.
    
    For example, you can add an additional media type of `image/png`, declaring that your *path operation* can return a JSON object (with media type `application/json`) or a PNG image:
    
    {* ../../docs_src/additional_responses/tutorial002_py310.py hl[17:22,26] *}
    
    /// note
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 8.9K bytes
    - Click Count (0)
Back to Top