Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 202 for Fields (0.21 sec)

  1. docs/zh/docs/tutorial/sql-databases.md

        我们将`SessionLocal()`请求的创建和处理放在一个`try`块中。
    
        然后我们在finally块中关闭它。
    
        通过这种方式,我们确保数据库会话在请求后始终关闭。即使在处理请求时出现异常。
    
        但是您不能从退出代码中引发另一个异常(在yield之后)。可以查阅 [Dependencies with yield and HTTPException](https://fastapi.tiangolo.com/zh/tutorial/dependencies/dependencies-with-yield/#dependencies-with-yield-and-httpexception)
    
    *然后,当在路径操作函数*中使用依赖项时,我们使用`Session`,直接从 SQLAlchemy 导入的类型声明它。
    
    *这将为我们在路径操作函数*中提供更好的编辑器支持,因为编辑器将知道`db`参数的类型`Session`:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 27K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_query_params/test_tutorial006_py310.py

        assert response.json() == IsDict(
            {
                "detail": [
                    {
                        "type": "missing",
                        "loc": ["query", "needy"],
                        "msg": "Field required",
                        "input": None,
                    },
                    {
                        "type": "int_parsing",
                        "loc": ["query", "skip"],
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  3. docs_src/graphql/tutorial001.py

    import strawberry
    from fastapi import FastAPI
    from strawberry.asgi import GraphQL
    
    
    @strawberry.type
    class User:
        name: str
        age: int
    
    
    @strawberry.type
    class Query:
        @strawberry.field
        def user(self) -> User:
            return User(name="Patrick", age=100)
    
    
    schema = strawberry.Schema(query=Query)
    
    
    graphql_app = GraphQL(schema)
    
    app = FastAPI()
    app.add_route("/graphql", graphql_app)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Oct 03 18:00:28 GMT 2021
    - 446 bytes
    - Viewed (0)
  4. fastapi/dependencies/utils.py

            return False
        else:
            assert isinstance(
                param_field.field_info, params.Body
            ), f"Param: {param_field.name} can only be a request body, using Body()"
            return True
    
    
    def add_param_to_fields(*, field: ModelField, dependant: Dependant) -> None:
        field_info = field.field_info
        field_info_in = getattr(field_info, "in_", None)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  5. docs/en/docs/tutorial/middleware.md

    * It can do something to that **response** or run any needed code.
    * Then it returns the **response**.
    
    !!! note "Technical Details"
        If you have dependencies with `yield`, the exit code will run *after* the middleware.
    
        If there were any background tasks (documented later), they will run *after* all the middleware.
    
    ## Create a middleware
    
    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)
  6. docs/de/docs/tutorial/middleware.md

    * Sie kann etwas mit dieser **Response** tun oder beliebigen Code ausführen.
    * Dann gibt sie die **Response** zurück.
    
    !!! note "Technische Details"
        Wenn Sie Abhängigkeiten mit `yield` haben, wird der Exit-Code *nach* der Middleware ausgeführt.
    
        Wenn es Hintergrundaufgaben gab (später dokumentiert), werden sie *nach* allen Middlewares ausgeführt.
    
    ## Erstellung einer Middleware
    
    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)
  7. docs/ru/docs/index.md

        <img src="https://img.shields.io/codecov/c/github/tiangolo/fastapi?color=%2334D058" alt="Coverage">
    </a>
    <a href="https://pypi.org/project/fastapi" target="_blank">
        <img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version">
    </a>
    <a href="https://pypi.org/project/fastapi" target="_blank">
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 29 05:18:04 GMT 2024
    - 25.8K bytes
    - Viewed (0)
  8. docs/zh/docs/tutorial/middleware.md

    * 它接收你的应用程序的每一个**请求**.
    * 然后它可以对这个**请求**做一些事情或者执行任何需要的代码.
    * 然后它将**请求**传递给应用程序的其他部分 (通过某种*路径操作*).
    * 然后它获取应用程序生产的**响应** (通过某种*路径操作*).
    * 它可以对该**响应**做些什么或者执行任何需要的代码.
    * 然后它返回这个 **响应**.
    
    !!! note "技术细节"
        如果你使用了 `yield` 关键字依赖, 依赖中的退出代码将在执行中间件*后*执行.
    
        如果有任何后台任务(稍后记录), 它们将在执行中间件*后*运行.
    
    ## 创建中间件
    
    要创建中间件你可以在函数的顶部使用装饰器 `@app.middleware("http")`.
    
    中间件参数接收如下参数:
    
    * `request`.
    * 一个函数 `call_next` 它将接收 `request` 作为参数.
    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/advanced/dataclasses.md

    ```{ .python .annotate hl_lines="1  5  8-11  14-17  23-25  28" }
    {!../../../docs_src/dataclasses/tutorial003.py!}
    ```
    
    1. We still import `field` from standard `dataclasses`.
    
    2. `pydantic.dataclasses` is a drop-in replacement for `dataclasses`.
    
    3. The `Author` dataclass includes a list of `Item` dataclasses.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  10. docs/zh/docs/index.md

        <img src="https://img.shields.io/codecov/c/github/tiangolo/fastapi?color=%2334D058" alt="Coverage">
    </a>
    <a href="https://pypi.org/project/fastapi" target="_blank">
        <img src="https://img.shields.io/pypi/v/fastapi?color=%2334D058&label=pypi%20package" alt="Package version">
    </a>
    <a href="https://pypi.org/project/fastapi" target="_blank">
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 29 05:18:04 GMT 2024
    - 18.2K bytes
    - Viewed (0)
Back to top