Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 148 for NONE (0.15 sec)

  1. docs/en/docs/release-notes.md

    from pydantic import BaseModel
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    app = FastAPI()
    
    @app.get("/items/invalidnone", response_model=Union[Item, None])
    def get_invalid_none():
        return None
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 03 23:25:42 GMT 2024
    - 388.1K bytes
    - Viewed (1)
  2. docs/en/docs/tutorial/query-params.md

    === "Python 3.10+"
    
        ```Python hl_lines="7"
        {!> ../../../docs_src/query_params/tutorial002_py310.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="9"
        {!> ../../../docs_src/query_params/tutorial002.py!}
        ```
    
    In this case, the function parameter `q` will be optional, and will be `None` by default.
    
    !!! check
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Oct 20 09:08:42 GMT 2023
    - 5.1K bytes
    - Viewed (0)
  3. docs/zh/docs/advanced/additional-responses.md

    ```
    
    !!! Note
    	- 请注意,您必须直接使用 `FileResponse` 返回图像。
    
    !!! Info
    	- 除非在 `responses` 参数中明确指定不同的媒体类型,否则**FastAPI**将假定响应与主响应类具有相同的媒体类型(默认为` application/json` )。
    	- 但是如果您指定了一个自定义响应类,并将 `None `作为其媒体类型,**FastAPI**将使用 `application/json` 作为具有关联模型的任何其他响应。
    
    ## 组合信息
    您还可以联合接收来自多个位置的响应信息,包括 `response_model `、 `status_code` 和 `responses `参数。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 09 15:53:39 GMT 2024
    - 8.2K bytes
    - Viewed (0)
  4. docs/ru/docs/tutorial/body-multiple-params.md

    Поскольку по умолчанию, отдельные значения интерпретируются как query-параметры, вам не нужно явно добавлять `Query`, вы можете просто сделать так:
    
    ```Python
    q: Union[str, None] = None
    ```
    
    Или в Python 3.10 и выше:
    
    ```Python
    q: str | None = None
    ```
    
    Например:
    
    === "Python 3.10+"
    
        ```Python hl_lines="27"
        {!> ../../../docs_src/body_multiple_params/tutorial004_an_py310.py!}
        ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.7K bytes
    - Viewed (0)
  5. docs/ru/docs/tutorial/response-model.md

        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="11  13-14"
        {!> ../../../docs_src/response_model/tutorial004.py!}
        ```
    
    * `description: Union[str, None] = None` (или `str | None = None` в Python 3.10), где `None` является значением по умолчанию.
    * `tax: float = 10.5`, где `10.5` является значением по умолчанию.
    * `tags: List[str] = []`, где пустой список `[]` является значением по умолчанию.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 30.5K bytes
    - Viewed (0)
  6. docs/fr/docs/tutorial/body.md

    Par exemple, le modèle ci-dessus déclare un "objet" JSON (ou `dict` Python) tel que :
    
    ```JSON
    {
        "name": "Foo",
        "description": "An optional description",
        "price": 45.2,
        "tax": 3.5
    }
    ```
    
    ...`description` et `tax` étant des attributs optionnels (avec `None` comme valeur par défaut), cet "objet" JSON serait aussi valide :
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/request-files.md

    !!! warning "警告"
    
        可在一个*路径操作*中声明多个 `File` 和 `Form` 参数,但不能同时声明要接收 JSON 的 `Body` 字段。因为此时请求体的编码是 `multipart/form-data`,不是 `application/json`。
    
        这不是 **FastAPI** 的问题,而是 HTTP 协议的规定。
    
    ## 可选文件上传
    
    您可以通过使用标准类型注解并将 None 作为默认值的方式将一个文件参数设为可选:
    
    === "Python 3.9+"
    
        ```Python hl_lines="7  14"
        {!> ../../../docs_src/request_files/tutorial001_02_py310.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="9  17"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 6.9K bytes
    - Viewed (0)
  8. docs/tr/docs/index.md

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 29 05:18:04 GMT 2024
    - 21.9K bytes
    - Viewed (0)
  9. docs/zh/docs/advanced/extending-openapi.md

    ...
    ```
    
    能打开这个文件就表示 FastAPI 应用能提供静态文件服务,并且文档要调用的静态文件放到了正确的位置。
    
    接下来,使用静态文件配置文档。
    
    ### 禁用 API 文档
    
    第一步是禁用 API 文档,就是使用 CDN 的默认文档。
    
    创建 `FastAPI` 应用时把文档的 URL 设置为 `None` 即可禁用默认文档:
    
    ```Python hl_lines="9"
    {!../../../docs_src/extending_openapi/tutorial002.py!}
    ```
    
    ### 添加自定义文档
    
    现在,创建自定义文档的*路径操作*。
    
    导入 FastAPI 内部函数为文档创建 HTML 页面,并把所需参数传递给这些函数:
    
    Plain Text
    - Registered: Sun Mar 31 07:19:09 GMT 2024
    - Last Modified: Sat Mar 30 22:46:12 GMT 2024
    - 7.7K bytes
    - Viewed (0)
  10. docs/fr/docs/index.md

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    
    
    @app.put("/items/{item_id}")
    def update_item(item_id: int, item: Item):
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 29 05:18:04 GMT 2024
    - 22K bytes
    - Viewed (0)
Back to top