Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 67 for NeXT (0.15 sec)

  1. docs_src/middleware/tutorial001.py

    import time
    
    from fastapi import FastAPI, Request
    
    app = FastAPI()
    
    
    @app.middleware("http")
    async def add_process_time_header(request: Request, call_next):
        start_time = time.time()
        response = await call_next(request)
        process_time = time.time() - start_time
        response.headers["X-Process-Time"] = str(process_time)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 349 bytes
    - Viewed (0)
  2. docs/en/docs/advanced/security/index.md

    !!! tip
        The next sections are **not necessarily "advanced"**.
    
        And it's possible that for your use case, the solution is in one of them.
    
    ## Read the Tutorial first
    
    The next sections assume you already read the main [Tutorial - User Guide: Security](../../tutorial/security/index.md){.internal-link target=_blank}.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Mar 31 23:52:53 GMT 2024
    - 633 bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/middleware.md

    ## Create a middleware
    
    To create a middleware you use the decorator `@app.middleware("http")` on top of a function.
    
    The middleware function receives:
    
    * The `request`.
    * A function `call_next` that will receive the `request` as a parameter.
        * This function will pass the `request` to the corresponding *path operation*.
        * Then it returns the `response` generated by the corresponding *path operation*.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 2.9K bytes
    - Viewed (0)
  4. docs/en/docs/advanced/middleware.md

    ## Integrated middlewares
    
    **FastAPI** includes several middlewares for common use cases, we'll see next how to use them.
    
    !!! note "Technical Details"
        For the next examples, you could also use `from starlette.middleware.something import SomethingMiddleware`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 10 18:27:10 GMT 2023
    - 4K bytes
    - Viewed (0)
  5. docs_src/security/tutorial003_an_py39.py

        if username in db:
            user_dict = db[username]
            return UserInDB(**user_dict)
    
    
    def fake_decode_token(token):
        # This doesn't provide any security at all
        # Check the next version
        user = get_user(fake_users_db, token)
        return user
    
    
    async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
        user = fake_decode_token(token)
        if not user:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 2.5K bytes
    - Viewed (0)
  6. docs/en/docs/benchmarks.md

        * If you are comparing Uvicorn, compare it against Daphne, Hypercorn, uWSGI, etc. Application servers.
    * **Starlette**:
        * Will have the next best performance, after Uvicorn. In fact, Starlette uses Uvicorn to run. So, it probably can only get "slower" than Uvicorn by having to execute more code.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  7. docs/de/docs/tutorial/middleware.md

    ## Erstellung einer Middleware
    
    Um eine Middleware zu erstellen, verwenden Sie den Dekorator `@app.middleware("http")` über einer Funktion.
    
    Die Middleware-Funktion erhält:
    
    * Den `request`.
    * Eine Funktion `call_next`, die den `request` als Parameter erhält.
        * Diese Funktion gibt den `request` an die entsprechende *Pfadoperation* weiter.
        * Dann gibt es die von der entsprechenden *Pfadoperation* generierte `response` zurück.
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 23 11:26:59 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  8. docs/zh/docs/tutorial/middleware.md

    !!! note "技术细节"
        如果你使用了 `yield` 关键字依赖, 依赖中的退出代码将在执行中间件*后*执行.
    
        如果有任何后台任务(稍后记录), 它们将在执行中间件*后*运行.
    
    ## 创建中间件
    
    要创建中间件你可以在函数的顶部使用装饰器 `@app.middleware("http")`.
    
    中间件参数接收如下参数:
    
    * `request`.
    * 一个函数 `call_next` 它将接收 `request` 作为参数.
        * 这个函数将 `request` 传递给相应的 *路径操作*.
        * 然后它将返回由相应的*路径操作*生成的 `response`.
    * 然后你可以在返回 `response` 前进一步修改它.
    
    ```Python hl_lines="8-9  11  14"
    {!../../../docs_src/middleware/tutorial001.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 27 17:25:21 GMT 2021
    - 2.7K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/body-fields.md

        ```
    
    `Field` works the same way as `Query`, `Path` and `Body`, it has all the same parameters, etc.
    
    !!! note "Technical Details"
        Actually, `Query`, `Path` and others you'll see next create objects of subclasses of a common `Param` class, which is itself a subclass of Pydantic's `FieldInfo` class.
    
        And Pydantic's `Field` returns an instance of `FieldInfo` as well.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 3.6K bytes
    - Viewed (0)
  10. docs/ja/docs/tutorial/middleware.md

        バックグラウンドタスク (後述) がある場合は、それらは全てのミドルウェアの *後に* 実行されます。
    
    ## ミドルウェアの作成
    
    ミドルウェアを作成するには、関数の上部でデコレータ `@app.middleware("http")` を使用します。
    
    ミドルウェア関数は以下を受け取ります:
    
    * `request`。
    * パラメータとして `request` を受け取る関数 `call_next`。
        * この関数は、対応する*path operation*に `request` を渡します。
        * 次に、対応する*path operation*によって生成された `response` を返します。
    * その後、`response` を返す前にさらに `response` を変更することもできます。
    
    ```Python hl_lines="8-9  11  14"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 3.8K bytes
    - Viewed (0)
Back to top