Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 179 for Sall (0.28 sec)

  1. docs/en/docs/tutorial/middleware.md

        If there were any background tasks (documented later), they will run *after* all the middleware.
    
    ## 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.
    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)
  2. docs/en/docs/deployment/manually.md

    Just keep in mind that when you read "server" in general, it could refer to one of those two things.
    
    When referring to the remote machine, it's common to call it **server**, but also **machine**, **VM** (virtual machine), **node**. Those all refer to some type of remote machine, normally running Linux, where you run programs.
    
    ## Install the Server Program
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 9.2K bytes
    - Viewed (0)
  3. tests/test_dependency_class.py

    
    class CallableDependency:
        def __call__(self, value: str) -> str:
            return value
    
    
    class CallableGenDependency:
        def __call__(self, value: str) -> Generator[str, None, None]:
            yield value
    
    
    class AsyncCallableDependency:
        async def __call__(self, value: str) -> str:
            return value
    
    
    class AsyncCallableGenDependency:
        async def __call__(self, value: str) -> AsyncGenerator[str, None]:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Aug 09 10:54:05 GMT 2020
    - 3.3K bytes
    - Viewed (0)
  4. 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)
  5. tests/test_additional_properties_bool.py

    
    @app.post("/")
    async def post(
        foo: Union[Foo, None] = None,
    ):
        return foo
    
    
    client = TestClient(app)
    
    
    def test_call_invalid():
        response = client.post("/", json={"foo": {"bar": "baz"}})
        assert response.status_code == 422
    
    
    def test_call_valid():
        response = client.post("/", json={})
        assert response.status_code == 200
        assert response.json() == {}
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.2K bytes
    - Viewed (0)
  6. docs/zh/docs/advanced/advanced-dependencies.md

    假设要创建校验查询参数 `q` 是否包含固定内容的依赖项。
    
    但此处要把待检验的固定内容定义为参数。
    
    ## **可调用**实例
    
    Python 可以把类实例变为**可调用项**。
    
    这里说的不是类本身(类本就是可调用项),而是类实例。
    
    为此,需要声明 `__call__` 方法:
    
    ```Python hl_lines="10"
    {!../../../docs_src/dependencies/tutorial011.py!}
    ```
    
    本例中,**FastAPI**  使用 `__call__` 检查附加参数及子依赖项,稍后,还要调用它向*路径操作函数*传递值。
    
    ## 参数化实例
    
    接下来,使用 `__init__` 声明用于**参数化**依赖项的实例参数:
    
    ```Python hl_lines="7"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Jan 28 18:26:57 GMT 2024
    - 2K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/security/get-current-user.md

    But you can have thousands of endpoints (*path operations*) using the same security system.
    
    And all of them (or any portion of them that you want) can take the advantage of re-using these dependencies or any other dependencies you create.
    
    And all these thousands of *path operations* can be as small as 3 lines:
    
    === "Python 3.10+"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  8. docs/em/docs/advanced/advanced-dependencies.md

    ✋️ 👥 💚 💪 🔗 👈 🔧 🎚.
    
    ##  "🇧🇲" 👐
    
    🐍 📤 🌌 ⚒ 👐 🎓 "🇧🇲".
    
    🚫 🎓 ⚫️ (❔ ⏪ 🇧🇲), ✋️ 👐 👈 🎓.
    
    👈, 👥 📣 👩‍🔬 `__call__`:
    
    ```Python hl_lines="10"
    {!../../../docs_src/dependencies/tutorial011.py!}
    ```
    
    👉 💼, 👉 `__call__` ⚫️❔ **FastAPI** 🔜 ⚙️ ✅ 🌖 🔢 & 🎧-🔗, & 👉 ⚫️❔ 🔜 🤙 🚶‍♀️ 💲 🔢 👆 *➡ 🛠️ 🔢* ⏪.
    
    ## 🔗 👐
    
    & 🔜, 👥 💪 ⚙️ `__init__` 📣 🔢 👐 👈 👥 💪 ⚙️ "🔗" 🔗:
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2K bytes
    - Viewed (0)
  9. docs/en/docs/benchmarks.md

        * Will have the best performance, as it doesn't have much extra code apart from the server itself.
        * You wouldn't write an application in Uvicorn directly. That would mean that your code would have to include more or less, at least, all the code provided by Starlette (or **FastAPI**). And if you did that, your final application would have the same overhead as having used a framework and minimizing your app code and bugs.
    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)
  10. docs_src/dependencies/tutorial011.py

    from fastapi import Depends, FastAPI
    
    app = FastAPI()
    
    
    class FixedContentQueryChecker:
        def __init__(self, fixed_content: str):
            self.fixed_content = fixed_content
    
        def __call__(self, q: str = ""):
            if q:
                return self.fixed_content in q
            return False
    
    
    checker = FixedContentQueryChecker("bar")
    
    
    @app.get("/query-checker/")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 504 bytes
    - Viewed (0)
Back to top