Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 32 for fixed (0.2 sec)

  1. docs_src/dependencies/tutorial011_an_py39.py

    
    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/")
    async def read_query_check(fixed_content_included: Annotated[bool, Depends(checker)]):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 544 bytes
    - Viewed (0)
  2. docs_src/dependencies/tutorial011.py

    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/")
    async def read_query_check(fixed_content_included: bool = Depends(checker)):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 504 bytes
    - Viewed (0)
  3. docs/zh/docs/advanced/advanced-dependencies.md

    {!../../../docs_src/dependencies/tutorial011.py!}
    ```
    
    这样就可以**参数化**依赖项,它包含 `checker.fixed_content` 的属性 - `"bar"`。
    
    ## 把实例作为依赖项
    
    然后,不要再在 `Depends(checker)` 中使用 `Depends(FixedContentQueryChecker)`, 而是要使用 `checker`,因为依赖项是类实例 - `checker`,不是类。
    
    处理依赖项时,**FastAPI** 以如下方式调用 `checker`:
    
    ```Python
    checker(q="somequery")
    ```
    
    ……并用*路径操作函数*的参数 `fixed_content_included` 返回依赖项的值:
    
    ```Python hl_lines="20"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jan 28 18:26:57 GMT 2024
    - 2K bytes
    - Viewed (0)
  4. docs/em/docs/advanced/advanced-dependencies.md

    ```
    
    & 👈 🌌 👥 💪 "🔗" 👆 🔗, 👈 🔜 ✔️ `"bar"` 🔘 ⚫️, 🔢 `checker.fixed_content`.
    
    ## ⚙️ 👐 🔗
    
    ⤴️, 👥 💪 ⚙️ 👉 `checker` `Depends(checker)`, ↩️ `Depends(FixedContentQueryChecker)`, ↩️ 🔗 👐, `checker`, 🚫 🎓 ⚫️.
    
    & 🕐❔ ❎ 🔗, **FastAPI** 🔜 🤙 👉 `checker` 💖:
    
    ```Python
    checker(q="somequery")
    ```
    
    ...& 🚶‍♀️ ⚫️❔ 👈 📨 💲 🔗 👆 *➡ 🛠️ 🔢* 🔢 `fixed_content_included`:
    
    ```Python hl_lines="20"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2K bytes
    - Viewed (0)
  5. docs/en/docs/advanced/testing-dependencies.md

    You send it a token and it returns an authenticated user.
    
    This provider might be charging you per request, and calling it might take some extra time than if you had a fixed mock user for tests.
    
    You probably want to test the external provider once, but not necessarily call it for every test that runs.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 2.9K bytes
    - Viewed (0)
  6. docs/ja/docs/tutorial/schema-extra-example.md

    そのため、OpenAPIでは同じ目的のために<a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#fixed-fields-20" class="external-link" target="_blank">`example`</a>を独自に定義しており(`examples`ではなく`example`として)、それがdocs UI(Swagger UIを使用)で使用されています。
    
    つまり、`example`はJSON Schemaの一部ではありませんが、OpenAPIの一部であり、それがdocs UIで使用されることになります。
    
    ## その他の情報
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 3K bytes
    - Viewed (0)
  7. docs/en/docs/deployment/versions.md

    **FastAPI** is already being used in production in many applications and systems. And the test coverage is kept at 100%. But its development is still moving quickly.
    
    New features are added frequently, bugs are fixed regularly, and the code is still continuously improving.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Nov 05 20:50:37 GMT 2020
    - 3.3K bytes
    - Viewed (0)
  8. fastapi/security/oauth2.py

            *,
            grant_type: Annotated[
                Union[str, None],
                Form(pattern="password"),
                Doc(
                    """
                    The OAuth2 spec says it is required and MUST be the fixed string
                    "password". Nevertheless, this dependency class is permissive and
                    allows not passing it. If you want to enforce it, use instead the
                    `OAuth2PasswordRequestFormStrict` dependency.
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  9. docs/en/docs/tutorial/path-params.md

    Several of these are explored in the next chapters of the tutorial.
    
    ## Order matters
    
    When creating *path operations*, you can find situations where you have a fixed path.
    
    Like `/users/me`, let's say that it's to get data about the current user.
    
    And then you can also have a path `/users/{user_id}` to get data about a specific user by some user ID.
    
    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/how-to/nosql-databases-couchbase.md

    ```Python hl_lines="3-5"
    {!../../../docs_src/nosql_databases/tutorial001.py!}
    ```
    
    ## Define a constant to use as a "document type"
    
    We will use it later as a fixed field `type` in our documents.
    
    This is not required by Couchbase, but is a good practice that will help you afterwards.
    
    ```Python hl_lines="9"
    {!../../../docs_src/nosql_databases/tutorial001.py!}
    ```
    
    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)
Back to top