- Sort Score
- Result 10 results
- Languages All
Results 1201 - 1210 of 1,977 for Fastapi (0.04 sec)
-
tests/main.py
import http from typing import FrozenSet, List, Optional from fastapi import FastAPI, Path, Query app = FastAPI() @app.api_route("/api_route") def non_operation(): return {"message": "Hello World"} def non_decorated_route(): return {"message": "Hello World"} app.add_api_route("/non_decorated_route", non_decorated_route) @app.get("/text") def get_text(): return "Hello World"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 21:56:59 UTC 2024 - 4.3K bytes - Viewed (0) -
tests/test_multi_query_errors.py
from typing import List from dirty_equals import IsDict from fastapi import FastAPI, Query from fastapi.testclient import TestClient app = FastAPI() @app.get("/items/") def read_items(q: List[int] = Query(default=None)): return {"q": q} client = TestClient(app) def test_multi_query(): response = client.get("/items/?q=5&q=6") assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 4.5K bytes - Viewed (0) -
tests/test_tutorial/test_query_params_str_validations/test_tutorial011_an.py
from dirty_equals import IsDict from fastapi.testclient import TestClient from docs_src.query_params_str_validations.tutorial011_an import app client = TestClient(app) def test_multi_query_values(): url = "/items/?q=foo&q=bar" response = client.get(url) assert response.status_code == 200, response.text assert response.json() == {"q": ["foo", "bar"]} def test_query_no_values(): url = "/items/"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 3.9K bytes - Viewed (0) -
tests/test_tutorial/test_security/test_tutorial006_an.py
from base64 import b64encode from fastapi.testclient import TestClient from docs_src.security.tutorial006_an import app client = TestClient(app) def test_security_http_basic(): response = client.get("/users/me", auth=("john", "secret")) assert response.status_code == 200, response.text assert response.json() == {"username": "john", "password": "secret"} def test_security_http_basic_no_credentials():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.3K bytes - Viewed (0) -
docs/zh/docs/advanced/wsgi.md
## 检查 现在,所有定义在 `/v1/` 路径下的请求将会被 Flask 应用处理。 其余的请求则会被 **FastAPI** 处理。 如果您使用 Uvicorn 运行应用实例并且访问 <a href="http://localhost:8000/v1/" class="external-link" target="_blank">http://localhost:8000/v1/</a>,您将会看到由 Flask 返回的响应: ```txt Hello, World from Flask! ``` 并且如果您访问 <a href="http://localhost:8000/v2" class="external-link" target="_blank">http://localhost:8000/v2</a>,您将会看到由 FastAPI 返回的响应: ```JSON { "message": "Hello World" }
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 1.2K bytes - Viewed (0) -
docs/zh/docs/tutorial/request-forms-and-files.md
# 请求表单与文件 FastAPI 支持同时使用 `File` 和 `Form` 定义文件和表单字段。 /// info | "说明" 接收上传文件或表单数据,要预先安装 <a href="https://github.com/Kludex/python-multipart" class="external-link" target="_blank">`python-multipart`</a>。 例如,`pip install python-multipart`。 /// ## 导入 `File` 与 `Form` ```Python hl_lines="1" {!../../docs_src/request_forms_and_files/tutorial001.py!} ``` ## 定义 `File` 与 `Form` 参数 创建文件和表单参数的方式与 `Body` 和 `Query` 一样:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 1.1K bytes - Viewed (0) -
tests/test_tutorial/test_cookie_params/test_tutorial001.py
import pytest from dirty_equals import IsDict from fastapi.testclient import TestClient from docs_src.cookie_params.tutorial001 import app @pytest.mark.parametrize( "path,cookies,expected_status,expected_response", [ ("/items", None, 200, {"ads_id": None}), ("/items", {"ads_id": "ads_track"}, 200, {"ads_id": "ads_track"}), ( "/items", {"ads_id": "ads_track", "session": "cookiesession"},
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 3.9K bytes - Viewed (0) -
tests/test_tutorial/test_header_params/test_tutorial003.py
import pytest from dirty_equals import IsDict from fastapi.testclient import TestClient from docs_src.header_params.tutorial003 import app client = TestClient(app) @pytest.mark.parametrize( "path,headers,expected_status,expected_response", [ ("/items", None, 200, {"X-Token values": None}), ("/items", {"x-token": "foo"}, 200, {"X-Token values": ["foo"]}), ( "/items",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jan 12 14:52:00 UTC 2024 - 4.1K bytes - Viewed (0) -
tests/test_tutorial/test_query_params_str_validations/test_tutorial012_an_py39.py
import pytest from fastapi.testclient import TestClient from ...utils import needs_py39 @pytest.fixture(name="client") def get_client(): from docs_src.query_params_str_validations.tutorial012_an_py39 import app client = TestClient(app) return client @needs_py39 def test_default_query_values(client: TestClient): url = "/items/" response = client.get(url)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.6K bytes - Viewed (0) -
docs/en/docs/advanced/behind-a-proxy.md
} ``` In this example, the "Proxy" could be something like **Traefik**. And the server would be something like FastAPI CLI with **Uvicorn**, running your FastAPI application. ### Providing the `root_path` To achieve this, you can use the command line option `--root-path` like: <div class="termy"> ```console $ fastapi run main.py --root-path /api/v1
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 27 16:49:49 UTC 2024 - 11.6K bytes - Viewed (0)