Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 91 for HTTPX (0.12 seconds)

  1. scripts/playwright/sql_databases/image02.py

        browser.close()
    
    
    process = subprocess.Popen(
        ["fastapi", "run", "docs_src/sql_databases/tutorial002.py"],
    )
    try:
        for _ in range(3):
            try:
                response = httpx.get("http://localhost:8000/docs")
            except httpx.ConnectError:
                time.sleep(1)
                break
        with sync_playwright() as playwright:
            run(playwright)
    finally:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Oct 09 19:44:42 GMT 2024
    - 1.1K bytes
    - Click Count (0)
  2. scripts/playwright/cookie_param_models/image01.py

    
    process = subprocess.Popen(
        ["fastapi", "run", "docs_src/cookie_param_models/tutorial001.py"]
    )
    try:
        for _ in range(3):
            try:
                response = httpx.get("http://localhost:8000/docs")
            except httpx.ConnectError:
                time.sleep(1)
                break
        with sync_playwright() as playwright:
            run(playwright)
    finally:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Sep 17 18:54:10 GMT 2024
    - 1.2K bytes
    - Click Count (0)
  3. docs/zh-hant/docs/advanced/async-tests.md

    若要在測試中呼叫非同步函式,測試函式本身也必須是非同步的。AnyIO 為此提供了一個好用的外掛,讓我們可以標示某些測試函式以非同步方式執行。
    
    ## HTTPX { #httpx }
    
    即使你的 FastAPI 應用使用一般的 `def` 函式而非 `async def`,它在底層仍然是個 `async` 應用。
    
    `TestClient` 在內部做了一些魔法,讓我們能在一般的 `def` 測試函式中,使用標準 pytest 來呼叫非同步的 FastAPI 應用。但當我們在非同步函式中使用它時,這個魔法就不再奏效了。也就是說,當以非同步方式執行測試時,就不能在測試函式內使用 `TestClient`。
    
    `TestClient` 是建立在 [HTTPX](https://www.python-httpx.org) 之上,所幸我們可以直接使用它來測試 API。
    
    ## 範例 { #example }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 3.5K bytes
    - Click Count (0)
  4. docs/en/docs/tutorial/testing.md

    It is based on [HTTPX](https://www.python-httpx.org), which in turn is designed based on Requests, so it's very familiar and intuitive.
    
    With it, you can use [pytest](https://docs.pytest.org/) directly with **FastAPI**.
    
    ## Using `TestClient` { #using-testclient }
    
    /// info
    
    To use `TestClient`, first install [`httpx`](https://www.python-httpx.org).
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 5.7K bytes
    - Click Count (0)
  5. docs/en/docs/advanced/async-tests.md

    If we want to call asynchronous functions in our tests, our test functions have to be asynchronous. AnyIO provides a neat plugin for this, that allows us to specify that some test functions are to be called asynchronously.
    
    ## HTTPX { #httpx }
    
    Even if your **FastAPI** application uses normal `def` functions instead of `async def`, it is still an `async` application underneath.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 3.8K bytes
    - Click Count (0)
  6. scripts/playwright/json_base64_bytes/image01.py

    
    process = subprocess.Popen(
        ["fastapi", "run", "docs_src/json_base64_bytes/tutorial001_py310.py"]
    )
    try:
        for _ in range(3):
            try:
                response = httpx.get("http://localhost:8000/docs")
            except httpx.ConnectError:
                time.sleep(1)
                break
        with sync_playwright() as playwright:
            run(playwright)
    finally:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 21 13:01:31 GMT 2026
    - 1.1K bytes
    - Click Count (0)
  7. docs/zh/docs/advanced/async-tests.md

    如果我们想在测试中调用异步函数,那么我们的测试函数必须是异步的。 AnyIO 为此提供了一个简洁的插件,它允许我们指定一些测试函数要异步调用。
    
    ## HTTPX { #httpx }
    
    即使您的 **FastAPI** 应用程序使用普通的 `def` 函数而不是 `async def` ,它本质上仍是一个 `async` 异步应用程序。
    
    `TestClient` 在内部通过一些“魔法”操作,使得您可以在普通的 `def` 测试函数中调用异步的 FastAPI 应用程序,并使用标准的 pytest。但当我们在异步函数中使用它时,这种“魔法”就不再生效了。由于测试以异步方式运行,我们无法在测试函数中继续使用 `TestClient`。
    
    `TestClient` 是基于 [HTTPX](https://www.python-httpx.org) 的。幸运的是,我们可以直接使用它来测试 API。
    
    ## 示例 { #example }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 3.9K bytes
    - Click Count (0)
  8. scripts/playwright/sql_databases/image01.py

        browser.close()
    
    
    process = subprocess.Popen(
        ["fastapi", "run", "docs_src/sql_databases/tutorial001.py"],
    )
    try:
        for _ in range(3):
            try:
                response = httpx.get("http://localhost:8000/docs")
            except httpx.ConnectError:
                time.sleep(1)
                break
        with sync_playwright() as playwright:
            run(playwright)
    finally:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Oct 09 19:44:42 GMT 2024
    - 1.1K bytes
    - Click Count (0)
  9. scripts/playwright/query_param_models/image01.py

    
    process = subprocess.Popen(
        ["fastapi", "run", "docs_src/query_param_models/tutorial001.py"]
    )
    try:
        for _ in range(3):
            try:
                response = httpx.get("http://localhost:8000/docs")
            except httpx.ConnectError:
                time.sleep(1)
                break
        with sync_playwright() as playwright:
            run(playwright)
    finally:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Sep 17 18:54:10 GMT 2024
    - 1.3K bytes
    - Click Count (0)
  10. pyproject.toml

        "python-slugify >=8.0.4",
        "pyyaml >=5.3.1,<7.0.0",
        "typer >=0.21.1",
    ]
    docs-tests = [
        "httpx >=0.23.0,<1.0.0",
        "ruff >=0.14.14",
        # For UJSONResponse
        "ujson >=5.8.0",
        # For ORJSONResponse
        "orjson >=3.9.3",
    ]
    github-actions = [
        "httpx >=0.27.0,<1.0.0",
        "pydantic >=2.9.0,<3.0.0",
        "pydantic-settings >=2.1.0,<3.0.0",
        "pygithub >=2.3.0,<3.0.0",
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Mar 23 12:36:49 GMT 2026
    - 10.3K bytes
    - Click Count (0)
Back to Top