Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 91 - 100 of 1,039 for Python (0.06 seconds)

  1. docs/en/docs/alternatives.md

    That's why, as said in the official website:
    
    > Requests is one of the most downloaded Python packages of all time
    
    The way you use it is very simple. For example, to do a `GET` request, you would write:
    
    ```Python
    response = requests.get("http://example.com/some/url")
    ```
    
    The FastAPI counterpart API *path operation* could look like:
    
    ```Python hl_lines="1"
    @app.get("/some/url")
    def read_url():
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 22.2K bytes
    - Click Count (0)
  2. docs/en/docs/reference/websockets.md

    Provided directly by Starlette, but you can import it from `fastapi`:
    
    ```python
    from fastapi.websockets import WebSocketDisconnect, WebSocketState
    ```
    
    ::: fastapi.websockets.WebSocketDisconnect
    
    When a client disconnects, a `WebSocketDisconnect` exception is raised, you can catch it.
    
    You can import it directly form `fastapi`:
    
    ```python
    from fastapi import WebSocketDisconnect
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 04 12:41:54 GMT 2026
    - 2K bytes
    - Click Count (0)
  3. docs/zh/docs/alternatives.md

    它们处在某种意义上的“对立端”,彼此互补。
    
    Requests 设计非常简单直观,易于使用,且有合理的默认值。同时它也非常强大、可定制。
    
    这就是为什么,正如其官网所说:
    
    > Requests 是有史以来下载量最高的 Python 包之一
    
    它的用法非常简单。例如,进行一次 `GET` 请求,你会这样写:
    
    ```Python
    response = requests.get("http://example.com/some/url")
    ```
    
    对应地,FastAPI 的 API 路径操作可能看起来是这样的:
    
    ```Python hl_lines="1"
    @app.get("/some/url")
    def read_url():
        return {"message": "Hello World"}
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 20.1K bytes
    - Click Count (0)
  4. docs/en/docs/tutorial/header-params.md

    But a variable like `user-agent` is invalid in Python.
    
    So, by default, `Header` will convert the parameter names characters from underscore (`_`) to hyphen (`-`) to extract and document the headers.
    
    Also, HTTP headers are case-insensitive, so, you can declare them with standard Python style (also known as "snake_case").
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Aug 31 09:15:41 GMT 2025
    - 3K bytes
    - Click Count (0)
  5. docs/zh/docs/tutorial/path-params.md

    # 路径参数 { #path-parameters }
    
    你可以使用与 Python 字符串格式化相同的语法声明路径“参数”或“变量”:
    
    {* ../../docs_src/path_params/tutorial001_py310.py hl[6:7] *}
    
    路径参数 `item_id` 的值会作为参数 `item_id` 传递给你的函数。
    
    运行示例并访问 [http://127.0.0.1:8000/items/foo](http://127.0.0.1:8000/items/foo),可获得如下响应:
    
    ```JSON
    {"item_id":"foo"}
    ```
    
    ## 声明路径参数的类型 { #path-parameters-with-types }
    
    使用 Python 标准类型注解,声明路径操作函数中路径参数的类型:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 7.6K bytes
    - Click Count (0)
  6. docs/zh/docs/index.md

    Pydantic 使用:
    
    * [`email-validator`](https://github.com/JoshData/python-email-validator) - 用于 email 校验。
    
    Starlette 使用:
    
    * [`httpx`](https://www.python-httpx.org) - 使用 `TestClient` 时需要。
    * [`jinja2`](https://jinja.palletsprojects.com) - 使用默认模板配置时需要。
    * [`python-multipart`](https://github.com/Kludex/python-multipart) - 使用 `request.form()` 支持表单<dfn title="将 HTTP 请求中的字符串转换为 Python 数据">「解析」</dfn>时需要。
    
    FastAPI 使用:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 20.7K bytes
    - Click Count (0)
  7. docs/en/docs/tutorial/query-params-str-validations.md

    Remember I told you before that `Annotated` can be used to add metadata to your parameters in the [Python Types Intro](../python-types.md#type-hints-with-metadata-annotations)?
    
    Now it's the time to use it with FastAPI. 🚀
    
    We had this type annotation:
    
    ```Python
    q: str | None = None
    ```
    
    What we will do is wrap that with `Annotated`, so it becomes:
    
    ```Python
    q: Annotated[str | None] = None
    ```
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 16.3K bytes
    - Click Count (0)
  8. docs/zh/docs/tutorial/query-params-str-validations.md

    ///
    
    ## 在 `q` 参数的类型中使用 `Annotated` { #use-annotated-in-the-type-for-the-q-parameter }
    
    还记得我之前在[Python 类型简介](../python-types.md#type-hints-with-metadata-annotations)中说过可以用 `Annotated` 给参数添加元数据吗?
    
    现在正是与 FastAPI 搭配使用它的时候。🚀
    
    我们之前的类型标注是:
    
    ```Python
    q: str | None = None
    ```
    
    我们要做的是用 `Annotated` 把它包起来,变成:
    
    ```Python
    q: Annotated[str | None] = None
    ```
    
    这两种写法含义相同,`q` 是一个可以是 `str` 或 `None` 的参数,默认是 `None`。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 15.4K bytes
    - Click Count (0)
  9. scripts/tests/test_translation_fixer/test_code_blocks/data/translated_doc_wrong_lang_code.md

    # Code blocks { #code-blocks }
    
    Some text
    
    ```python
    # This is a sample Python code block
    def hello_world():
        # Comment with indentation
        print("Hello, world!")  # Print greeting
    ```
    
    Some more text
    
    The following block has wrong language code (should be TOML):
    
    ```yaml
    # This is a sample TOML code block
    title = "TOML Example"  # Title of the document
    ```
    
    And more text
    
    ```console
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Jan 10 21:48:08 GMT 2026
    - 946 bytes
    - Click Count (0)
  10. docs/es/docs/index.md

    Lo haces con tipos estándar modernos de Python.
    
    No tienes que aprender una nueva sintaxis, los métodos o clases de un paquete específico, etc.
    
    Solo **Python** estándar.
    
    Por ejemplo, para un `int`:
    
    ```Python
    item_id: int
    ```
    
    o para un modelo `Item` más complejo:
    
    ```Python
    item: Item
    ```
    
    ...y con esa única declaración obtienes:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:15:55 GMT 2026
    - 22.6K bytes
    - Click Count (0)
Back to Top