Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 94 for Pookins (0.2 sec)

  1. docs/zh/docs/advanced/response-cookies.md

    # 响应Cookies
    
    ## 使用 `Response` 参数
    
    你可以在 *路径函数* 中定义一个类型为 `Response`的参数,这样你就可以在这个临时响应对象中设置cookie了。
    
    ```Python hl_lines="1  8-9"
    {!../../../docs_src/response_cookies/tutorial002.py!}
    ```
    
    而且你还可以根据你的需要响应不同的对象,比如常用的 `dict`,数据库model等。
    
    如果你定义了 `response_model`,程序会自动根据`response_model`来过滤和转换你响应的对象。
    
    **FastAPI** 会使用这个 *临时* 响应对象去装在这些cookies信息 (同样还有headers和状态码等信息), 最终会将这些信息和通过`response_model`转化过的数据合并到最终的响应里。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Aug 18 16:09:38 GMT 2022
    - 2.1K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_response_cookies/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.response_cookies.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.post("/cookie/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Come to the dark side, we have cookies"}
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 403 bytes
    - Viewed (0)
  3. docs/en/docs/advanced/response-headers.md

    **FastAPI** will use that *temporal* response to extract the headers (also cookies and status code), and will put them in the final response that contains the value you returned, filtered by any `response_model`.
    
    You can also declare the `Response` parameter in dependencies, and set headers (and cookies) in them.
    
    ## Return a `Response` directly
    
    You can also add headers when you return a `Response` directly.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_cookie_params/test_tutorial001_an_py310.py

                {"ads_id": "ads_track"},
            ),
            ("/items", {"session": "cookiesession"}, 200, {"ads_id": None}),
        ],
    )
    def test(path, cookies, expected_status, expected_response):
        from docs_src.cookie_params.tutorial001_an_py310 import app
    
        client = TestClient(app, cookies=cookies)
        response = client.get(path)
        assert response.status_code == expected_status
        assert response.json() == expected_response
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.1K bytes
    - Viewed (0)
  5. docs_src/response_cookies/tutorial002.py

    app = FastAPI()
    
    
    @app.post("/cookie-and-object/")
    def create_cookie(response: Response):
        response.set_cookie(key="fakesession", value="fake-cookie-session-value")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 272 bytes
    - Viewed (0)
  6. docs/de/docs/reference/websockets.md

        options:
            members:
                - scope
                - app
                - url
                - base_url
                - headers
                - query_params
                - path_params
                - cookies
                - client
                - state
                - url_for
                - client_state
                - application_state
                - receive
                - send
                - accept
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 18:16:27 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  7. README.md

    ---
    
    "_If you're looking to learn one **modern framework** for building REST APIs, check out **FastAPI** [...] It's fast, easy to use and easy to learn [...]_"
    
    "_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_"
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 21.9K bytes
    - Viewed (0)
  8. docs/uk/docs/index.md

    ---
    
    "_If you're looking to learn one **modern framework** for building REST APIs, check out **FastAPI** [...] It's fast, easy to use and easy to learn [...]_"
    
    "_We've switched over to **FastAPI** for our **APIs** [...] I think you'll like it [...]_"
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 24.2K bytes
    - Viewed (0)
  9. docs/ru/docs/tutorial/testing.md

    * Если же Вам необходимо отправить *форму с данными* вместо JSON, то используйте параметр `data` вместо `json`.
    * Для передачи *заголовков*, передайте объект `dict` через параметр `headers`.
    * Для передачи *cookies* также передайте `dict`, но через параметр `cookies`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.2K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_websockets/test_tutorial002_an_py310.py

        assert response.status_code == 200, response.text
        assert b"<!DOCTYPE html>" in response.content
    
    
    @needs_py310
    def test_websocket_with_cookie(app: FastAPI):
        client = TestClient(app, cookies={"session": "fakesession"})
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/foo/ws") as websocket:
                message = "Message one"
                websocket.send_text(message)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 3.9K bytes
    - Viewed (0)
Back to top