- Sort Score
- Result 10 results
- Languages All
Results 1801 - 1810 of 1,929 for FastAPI (0.1 sec)
-
docs_src/bigger_applications/app_an_py39/dependencies.py
from typing import Annotated from fastapi import Header, HTTPException async def get_token_header(x_token: Annotated[str, Header()]): if x_token != "fake-super-secret-token": raise HTTPException(status_code=400, detail="X-Token header invalid") async def get_query_token(token: str): if token != "jessica":
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 409 bytes - Viewed (0) -
tests/test_tutorial/test_response_headers/test_tutorial001.py
from fastapi.testclient import TestClient from docs_src.response_headers.tutorial001 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 Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jul 09 18:06:12 UTC 2020 - 426 bytes - Viewed (0) -
docs/ja/docs/tutorial/path-params-numeric-validations.md
# パスパラメータと数値の検証 クエリパラメータに対して`Query`でより多くのバリデーションとメタデータを宣言できるのと同じように、パスパラメータに対しても`Path`で同じ種類のバリデーションとメタデータを宣言することができます。 ## Pathのインポート まず初めに、`fastapi`から`Path`をインポートします: ```Python hl_lines="1" {!../../docs_src/path_params_numeric_validations/tutorial001.py!} ``` ## メタデータの宣言 パラメータは`Query`と同じものを宣言することができます。 例えば、パスパラメータ`item_id`に対して`title`のメタデータを宣言するには以下のようにします: ```Python hl_lines="8"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6.1K bytes - Viewed (0) -
docs/ko/docs/tutorial/body.md
//// //// tab | Python 3.8+ ```Python hl_lines="18" {!> ../../docs_src/body/tutorial001.py!} ``` //// ...그리고 만들어낸 모델인 `Item`으로 타입을 선언합니다. ## 결과 위에서의 단순한 파이썬 타입 선언으로, **FastAPI**는 다음과 같이 동작합니다: * 요청의 본문을 JSON으로 읽어 들입니다. * (필요하다면) 대응되는 타입으로 변환합니다. * 데이터를 검증합니다. * 만약 데이터가 유효하지 않다면, 정확히 어떤 것이 그리고 어디에서 데이터가 잘 못 되었는지 지시하는 친절하고 명료한 에러를 반환할 것입니다. * 매개변수 `item`에 포함된 수신 데이터를 제공합니다.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 8.7K bytes - Viewed (0) -
tests/test_tutorial/test_custom_response/test_tutorial009.py
from pathlib import Path from fastapi.testclient import TestClient from docs_src.custom_response import tutorial009 from docs_src.custom_response.tutorial009 import app client = TestClient(app) def test_get(tmp_path: Path): file_path: Path = tmp_path / "large-video-file.mp4" tutorial009.some_file_path = str(file_path) test_content = b"Fake video bytes" file_path.write_bytes(test_content) response = client.get("/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Jul 03 19:51:28 UTC 2021 - 487 bytes - Viewed (0) -
docs/zh/docs/tutorial/security/get-current-user.md
{!../../docs_src/security/tutorial002.py!} ``` 注意,此处把 `current_user` 的类型声明为 Pydantic 的 `User` 模型。 这有助于在函数内部使用代码补全和类型检查。 /// tip | "提示" 还记得请求体也是使用 Pydantic 模型声明的吧。 放心,因为使用了 `Depends`,**FastAPI** 不会搞混。 /// /// check | "检查" 依赖系统的这种设计方式可以支持不同的依赖项返回同一个 `User` 模型。 而不是局限于只能有一个返回该类型数据的依赖项。 /// ## 其它模型 接下来,直接在*路径操作函数*中获取当前用户,并用 `Depends` 在**依赖注入**系统中处理安全机制。
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 3.5K bytes - Viewed (0) -
tests/test_tutorial/test_sql_databases/test_tutorial001.py
import importlib import warnings import pytest from dirty_equals import IsDict, IsInt from fastapi.testclient import TestClient from inline_snapshot import snapshot from sqlalchemy import StaticPool from sqlmodel import SQLModel, create_engine from sqlmodel.main import default_registry from tests.utils import needs_py39, needs_py310 def clear_sqlmodel(): # Clear the tables in the metadata for the default base model
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 14.8K bytes - Viewed (0) -
tests/test_tutorial/test_additional_status_codes/test_tutorial001.py
from fastapi.testclient import TestClient from docs_src.additional_status_codes.tutorial001 import app client = TestClient(app) def test_update(): response = client.put("/items/foo", json={"name": "Wrestlers"}) assert response.status_code == 200, response.text assert response.json() == {"name": "Wrestlers", "size": None} def test_create(): response = client.put("/items/red", json={"name": "Chillies"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jul 09 18:06:12 UTC 2020 - 546 bytes - Viewed (0) -
tests/test_tutorial/test_additional_status_codes/test_tutorial001_an.py
from fastapi.testclient import TestClient from docs_src.additional_status_codes.tutorial001_an import app client = TestClient(app) def test_update(): response = client.put("/items/foo", json={"name": "Wrestlers"}) assert response.status_code == 200, response.text assert response.json() == {"name": "Wrestlers", "size": None} def test_create(): response = client.put("/items/red", json={"name": "Chillies"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 549 bytes - Viewed (0) -
docs/de/docs/how-to/conditional-openapi.md
{!../../docs_src/conditional_openapi/tutorial001.py!} ``` Hier deklarieren wir die Einstellung `openapi_url` mit dem gleichen Defaultwert `"/openapi.json"`. Und dann verwenden wir das beim Erstellen der `FastAPI`-App. Dann könnten Sie OpenAPI (einschließlich der Dokumentationsoberflächen) deaktivieren, indem Sie die Umgebungsvariable `OPENAPI_URL` auf einen leeren String setzen, wie zum Beispiel: <div class="termy"> ```console
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 2.8K bytes - Viewed (0)