Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 53 for function (0.16 sec)

  1. docs/en/docs/tutorial/response-model.md

    # Response Model - Return Type
    
    You can declare the type used for the response by annotating the *path operation function* **return type**.
    
    You can use **type annotations** the same way you would for input data in function **parameters**, you can use Pydantic models, lists, dictionaries, scalar values like integers, booleans, etc.
    
    === "Python 3.10+"
    
        ```Python hl_lines="16  21"
        {!> ../../../docs_src/response_model/tutorial001_01_py310.py!}
        ```
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17.9K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/first-steps.md

    ### Step 4: define the **path operation function**
    
    This is our "**path operation function**":
    
    * **path**: is `/`.
    * **operation**: is `get`.
    * **function**: is the function below the "decorator" (below `@app.get("/")`).
    
    ```Python hl_lines="7"
    {!../../../docs_src/first_steps/tutorial001.py!}
    ```
    
    This is a Python function.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 12K bytes
    - Viewed (0)
  3. docs/en/docs/reference/background.md

    # Background Tasks - `BackgroundTasks`
    
    You can declare a parameter in a *path operation function* or dependency function with the type `BackgroundTasks`, and then you can use it to schedule the execution of background tasks after the response is sent.
    
    You can import it directly from `fastapi`:
    
    ```python
    from fastapi import BackgroundTasks
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 377 bytes
    - Viewed (0)
  4. docs/en/docs/advanced/generate-clients.md

    ### Custom Generate Unique ID Function
    
    FastAPI uses a **unique ID** for each *path operation*, it is used for the **operation ID** and also for the names of any needed custom models, for requests or responses.
    
    You can customize that function. It takes an `APIRoute` and outputs a string.
    
    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)
  5. docs/en/docs/reference/request.md

    # `Request` class
    
    You can declare a parameter in a *path operation function* or dependency to be of type `Request` and then you can access the raw request object directly, without any validation, etc.
    
    You can import it directly from `fastapi`:
    
    ```python
    from fastapi import Request
    ```
    
    !!! tip
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 516 bytes
    - Viewed (0)
  6. docs/en/docs/advanced/dataclasses.md

    8. Notice that this *path operation function* uses regular `def` instead of `async def`.
    
        As always, in FastAPI you can combine `def` and `async def` as needed.
    
        If you need a refresher about when to use which, check out the section _"In a hurry?"_ in the docs about [`async` and `await`](../async.md#in-a-hurry){.internal-link target=_blank}.
    
    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)
  7. fastapi/param_functions.py

            **extra,
        )
    
    
    def Depends(  # noqa: N802
        dependency: Annotated[
            Optional[Callable[..., Any]],
            Doc(
                """
                A "dependable" callable (like a function).
    
                Don't call it directly, FastAPI will call it for you, just pass the object
                directly.
                """
            ),
        ] = None,
        *,
        use_cache: Annotated[
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 62.5K bytes
    - Viewed (0)
  8. docs/en/docs/alternatives.md

    It is designed to have functions that receive two parameters, one "request" and one "response". Then you "read" parts from the request, and "write" parts to the response. Because of this design, it is not possible to declare request parameters and bodies with standard Python type hints as function parameters.
    
    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)
  9. docs/vi/docs/features.md

    Bạn viết chuẩn Python với kiểu dữ liệu như sau:
    
    ```Python
    from datetime import date
    
    from pydantic import BaseModel
    
    # Declare a variable as a str
    # and get editor support inside the function
    def main(user_id: str):
        return user_id
    
    
    # A Pydantic model
    class User(BaseModel):
        id: int
        name: str
        joined: date
    ```
    
    Sau đó có thể được sử dụng:
    
    ```Python
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/dependencies/index.md

    !!! tip
        You'll see what other "things", apart from functions, can be used as dependencies in the next chapter.
    
    Whenever a new request arrives, **FastAPI** will take care of:
    
    * Calling your dependency ("dependable") function with the correct parameters.
    * Get the result from your function.
    * Assign that result to the parameter in your *path operation function*.
    
    ```mermaid
    graph TB
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.6K bytes
    - Viewed (0)
Back to top