Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 188 for function (0.18 sec)

  1. tests/test_generate_unique_id_function.py

        app = FastAPI(generate_unique_id_function=custom_generate_unique_id)
        router = APIRouter(generate_unique_id_function=custom_generate_unique_id2)
    
        @app.post(
            "/",
            response_model=List[Item],
            responses={404: {"model": List[Message]}},
            generate_unique_id_function=custom_generate_unique_id3,
        )
        def post_root(item1: Item, item2: Item):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Jan 13 15:10:26 GMT 2024
    - 66.7K bytes
    - Viewed (0)
  2. docs/en/docs/how-to/nosql-databases-couchbase.md

    ## Get the user
    
    Now create a function that will:
    
    * Take a username.
    * Generate a document ID from it.
    * Get the document with that ID.
    * Put the contents of the document in a `UserInDB` model.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 6K bytes
    - Viewed (0)
  3. docs/em/docs/advanced/settings.md

    participant code as Code
    participant function as say_hi()
    participant execute as Execute function
    
        rect rgba(0, 255, 0, .1)
            code ->> function: say_hi(name="Camila")
            function ->> execute: execute function code
            execute ->> code: return the result
        end
    
        rect rgba(0, 255, 255, .1)
            code ->> function: say_hi(name="Camila")
            function ->> code: return stored result
        end
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.4K bytes
    - Viewed (0)
  4. docs/en/docs/how-to/custom-request-and-route.md

    Next, we create a custom subclass of `fastapi.routing.APIRoute` that will make use of the `GzipRequest`.
    
    This time, it will overwrite the method `APIRoute.get_route_handler()`.
    
    This method returns a function. And that function is what will receive a request and return a response.
    
    Here we use it to create a `GzipRequest` from the original request.
    
    ```Python hl_lines="18-26"
    {!../../../docs_src/custom_request_and_route/tutorial001.py!}
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Mar 31 23:52:53 GMT 2024
    - 4.4K bytes
    - Viewed (0)
  5. docs/en/docs/how-to/async-sql-encode-databases.md

    {!../../../docs_src/async_sql_databases/tutorial001.py!}
    ```
    
    ## Read notes
    
    Create the *path operation function* to read notes:
    
    ```Python hl_lines="55-58"
    {!../../../docs_src/async_sql_databases/tutorial001.py!}
    ```
    
    !!! note
        Notice that as we communicate with the database using `await`, the *path operation function* is declared with `async`.
    
    ### Notice the `response_model=List[Note]`
    
    It uses `typing.List`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  6. docs/en/docs/advanced/events.md

        Maybe you need to start a new version, or you just got tired of running it. 🤷
    
    ### Lifespan function
    
    The first thing to notice, is that we are defining an async function with `yield`. This is very similar to Dependencies with `yield`.
    
    ```Python hl_lines="14-19"
    {!../../../docs_src/events/tutorial003.py!}
    ```
    
    The first part of the function, before the `yield`, will be executed **before** the application starts.
    
    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)
  7. docs/en/docs/advanced/using-request-directly.md

    ## Use the `Request` object directly
    
    Let's imagine you want to get the client's IP address/host inside of your *path operation function*.
    
    For that you need to access the request directly.
    
    ```Python hl_lines="1  7-8"
    {!../../../docs_src/using_request_directly/tutorial001.py!}
    ```
    
    By declaring a *path operation function* parameter with the type being the `Request` **FastAPI** will know to pass the `Request` in that parameter.
    
    !!! tip
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Aug 29 14:02:58 GMT 2020
    - 2.3K bytes
    - Viewed (0)
  8. docs/en/docs/python-types.md

    At some point you would have started the definition of the function, you had the parameters ready...
    
    But then you have to call "that method that converts the first letter to upper case".
    
    Was it `upper`? Was it `uppercase`? `first_uppercase`? `capitalize`?
    
    Then, you try with the old programmer's friend, editor autocompletion.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 17K bytes
    - Viewed (0)
  9. docs/en/docs/advanced/settings.md

            execute ->> code: return the result
        end
    
        rect rgba(0, 255, 255, .1)
            code ->> function: say_hi(name="Camila")
            function ->> code: return stored result
        end
    
        rect rgba(0, 255, 0, .1)
            code ->> function: say_hi(name="Rick")
            function ->> execute: execute function code
            execute ->> code: return the result
        end
    
    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)
  10. docs/en/docs/reference/uploadfile.md

    # `UploadFile` class
    
    You can define *path operation function* parameters to be of the type `UploadFile` to receive files from the request.
    
    You can import it directly from `fastapi`:
    
    ```python
    from fastapi import UploadFile
    ```
    
    ::: fastapi.UploadFile
        options:
            members:
                - file
                - filename
                - size
                - headers
                - content_type
                - read
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 472 bytes
    - Viewed (0)
Back to top