Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 142 for function (0.25 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/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)
  3. 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)
  4. docs/zh/docs/advanced/settings.md

    sequenceDiagram
    
    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 ->> code: θΏ”ε›žη»“ζžœ
        end
    
        rect rgba(0, 255, 255, .1)
            code ->> function: say_hi(name="Camila")
            function ->> code: θΏ”ε›žε­˜ε‚¨ηš„η»“ζžœ
        end
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 13.9K bytes
    - Viewed (0)
  5. docs/en/docs/tutorial/dependencies/classes-as-dependencies.md

    The key factor is that a dependency should be a "callable".
    
    A "**callable**" in Python is anything that Python can "call" like a function.
    
    So, if you have an object `something` (that might _not_ be a function) and you can "call" it (execute it) like:
    
    ```Python
    something()
    ```
    
    or
    
    ```Python
    something(some_argument, some_keyword_argument="foo")
    ```
    
    then it is a "callable".
    
    ## Classes as dependencies
    
    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)
  6. docs/en/docs/tutorial/path-params-numeric-validations.md

    !!! note "Technical Details"
        When you import `Query`, `Path` and others from `fastapi`, they are actually functions.
    
        That when called, return instances of classes of the same name.
    
        So, you import `Query`, which is a function. And when you call it, it returns an instance of a class also named `Query`.
    
        These functions are there (instead of just using the classes directly) so that your editor doesn't mark errors about their types.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/sql-databases.md

    A "middleware" is basically a function that is always executed for each request, with some code executed before, and some code executed after the endpoint function.
    
    ### Create a middleware
    
    The middleware we'll add (just a function) will create a new SQLAlchemy `SessionLocal` for each request, add it to the request and then close it once the request is finished.
    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)
  8. docs/en/docs/tutorial/dependencies/dependencies-with-yield.md

    ## Context Managers
    
    ### What are "Context Managers"
    
    "Context Managers" are any of those Python objects that you can use in a `with` statement.
    
    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)
  9. docs/en/docs/tutorial/handling-errors.md

    Because it's a Python exception, you don't `return` it, you `raise` it.
    
    This also means that if you are inside a utility function that you are calling inside of your *path operation function*, and you raise the `HTTPException` from inside of that utility function, it won't run the rest of the code in the *path operation function*, it will terminate that request right away and send the HTTP error from the `HTTPException` to the client.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  10. docs/en/docs/advanced/templates.md

    So, the section with:
    
    {% raw %}
    
    ```jinja
    <a href="{{ url_for('read_item', id=id) }}">
    ```
    
    {% endraw %}
    
    ...will generate a link to the same URL that would be handled by the *path operation function* `read_item(id=id)`.
    
    For example, with an ID of `42`, this would render:
    
    ```html
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 22:25:37 GMT 2024
    - 3.2K bytes
    - Viewed (0)
Back to top