Search Options

Results per page
Sort
Preferred Languages
Advance

Results 641 - 650 of 924 for docs_src (0.09 sec)

  1. tests/test_tutorial/test_custom_request_and_route/test_tutorial001.py

            pytest.param("tutorial001_an_py39"),
            pytest.param("tutorial001_an_py310", marks=needs_py310),
        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(f"docs_src.custom_request_and_route.{request.param}")
    
        @mod.app.get("/check-class")
        async def check_gzip_request(request: Request):
            return {"request_class": type(request).__name__}
    
        client = TestClient(mod.app)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  2. docs/uk/docs/tutorial/cookie-param-models.md

    ///
    
    ## Cookie з Pydantic-моделлю
    
    Оголосіть **cookie-параметри**, які Вам потрібні, у **Pydantic-моделі**, а потім оголосіть параметр як `Cookie`:
    
    {* ../../docs_src/cookie_param_models/tutorial001_an_py310.py hl[9:12,16] *}
    
    **FastAPI** буде **витягувати** дані для **кожного поля** з **cookie** параметрів, отриманих у запиті, і передавати Вам Pydantic-модель, яку Ви визначили.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Mar 19 17:03:38 UTC 2025
    - 4.7K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_response_headers/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_headers.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/headers/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Hello World"}
        assert response.headers["X-Cat-Dog"] == "alone in the world"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 431 bytes
    - Viewed (0)
  4. tests/test_tutorial/test_additional_responses/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.additional_responses.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/items/foo")
        assert response.status_code == 200, response.text
        assert response.json() == {"id": "foo", "value": "there goes my hero"}
    
    
    def test_path_operation_not_found():
        response = client.get("/items/bar")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 4.3K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_handling_errors/test_tutorial005.py

    from fastapi.testclient import TestClient
    
    from docs_src.handling_errors.tutorial005_py39 import app
    
    client = TestClient(app)
    
    
    def test_post_validation_error():
        response = client.post("/items/", json={"title": "towel", "size": "XL"})
        assert response.status_code == 422, response.text
        assert response.json() == {
            "detail": [
                {
                    "type": "int_parsing",
                    "loc": ["body", "size"],
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 3.9K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/security/oauth2-jwt.md

    创建设置令牌过期时间的变量。
    
    定义令牌端点响应的 Pydantic 模型。
    
    创建生成新的访问令牌的工具函数。
    
    {* ../../docs_src/security/tutorial004.py hl[6,12:14,28:30,78:86] *}
    
    ## 更新依赖项
    
    更新 `get_current_user` 以接收与之前相同的令牌,但这里用的是 JWT 令牌。
    
    解码并校验接收到的令牌,然后,返回当前用户。
    
    如果令牌无效,则直接返回 HTTP 错误。
    
    {* ../../docs_src/security/tutorial004_an_py310.py hl[4,7,13:15,29:31,79:87] *}
    
    ## 更新 `/token` *路径操作*
    
    用令牌过期时间创建 `timedelta` 对象。
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_metadata/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.metadata.tutorial001_py39 import app
    
    client = TestClient(app)
    
    
    def test_items():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [{"name": "Katana"}]
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.7K bytes
    - Viewed (0)
  8. docs/ja/docs/tutorial/request-forms.md

    たとえば、`pip install python-multipart`のように。
    
    ///
    
    ## `Form`のインポート
    
    `fastapi`から`Form`をインポートします:
    
    {* ../../docs_src/request_forms/tutorial001.py hl[1] *}
    
    ## `Form`のパラメータの定義
    
    `Body`や`Query`の場合と同じようにフォームパラメータを作成します:
    
    {* ../../docs_src/request_forms/tutorial001.py hl[7] *}
    
    例えば、OAuth2仕様が使用できる方法の1つ(「パスワードフロー」と呼ばれる)では、フォームフィールドとして`username`と`password`を送信する必要があります。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  9. docs/en/docs/advanced/wsgi.md

    ## Using `WSGIMiddleware` { #using-wsgimiddleware }
    
    You need to import `WSGIMiddleware`.
    
    Then wrap the WSGI (e.g. Flask) app with the middleware.
    
    And then mount that under a path.
    
    {* ../../docs_src/wsgi/tutorial001_py39.py hl[2:3,3] *}
    
    ## Check it { #check-it }
    
    Now, every request under the path `/v1/` will be handled by the Flask application.
    
    And the rest will be handled by **FastAPI**.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 1.2K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_handling_errors/test_tutorial002.py

    from fastapi.testclient import TestClient
    
    from docs_src.handling_errors.tutorial002_py39 import app
    
    client = TestClient(app)
    
    
    def test_get_item_header():
        response = client.get("/items-header/foo")
        assert response.status_code == 200, response.text
        assert response.json() == {"item": "The Foo Wrestlers"}
    
    
    def test_get_item_not_found_header():
        response = client.get("/items-header/bar")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 3.3K bytes
    - Viewed (0)
Back to top