- Sort Score
- Result 10 results
- Languages All
Results 131 - 140 of 1,976 for Fastapi (0.12 sec)
-
tests/test_additional_responses_response_class.py
import typing from fastapi import FastAPI from fastapi.responses import JSONResponse from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class JsonApiResponse(JSONResponse): media_type = "application/vnd.api+json" class Error(BaseModel): status: str title: str class JsonApiError(BaseModel): errors: typing.List[Error] @app.get( "/a",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.5K bytes - Viewed (0) -
tests/test_http_connection_injection.py
from fastapi import Depends, FastAPI from fastapi.requests import HTTPConnection from fastapi.testclient import TestClient from starlette.websockets import WebSocket app = FastAPI() app.state.value = 42 async def extract_value_from_http_connection(conn: HTTPConnection): return conn.app.state.value @app.get("/http") async def get_value_by_http(value: int = Depends(extract_value_from_http_connection)): return value
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Aug 09 13:56:41 UTC 2020 - 972 bytes - Viewed (0) -
docs/em/docs/advanced/middleware.md
app = SomeASGIApp() new_app = UnicornMiddleware(app, some_config="rainbow") ``` ✋️ FastAPI (🤙 💃) 🚚 🙅 🌌 ⚫️ 👈 ⚒ 💭 👈 🔗 🛠️ 🍵 💽 ❌ & 🛃 ⚠ 🐕🦺 👷 ☑. 👈, 👆 ⚙️ `app.add_middleware()` (🖼 ⚜). ```Python from fastapi import FastAPI from unicorn import UnicornMiddleware app = FastAPI() app.add_middleware(UnicornMiddleware, some_config="rainbow") ```
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 3.2K bytes - Viewed (0) -
docs/zh/docs/tutorial/first-steps.md
... ``` #### OpenAPI 的用途 驱动 FastAPI 内置的 2 个交互式文档系统的正是 OpenAPI 模式。 并且还有数十种替代方案,它们全部都基于 OpenAPI。你可以轻松地将这些替代方案中的任何一种添加到使用 **FastAPI** 构建的应用程序中。 你还可以使用它自动生成与你的 API 进行通信的客户端代码。例如 web 前端,移动端或物联网嵌入程序。 ## 分步概括 ### 步骤 1:导入 `FastAPI` ```Python hl_lines="1" {!../../docs_src/first_steps/tutorial001.py!} ``` `FastAPI` 是一个为你的 API 提供了所有功能的 Python 类。 /// note | "技术细节"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 9.1K bytes - Viewed (0) -
docs_src/custom_response/tutorial006c.py
from fastapi import FastAPI from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/pydantic", response_class=RedirectResponse, status_code=302) async def redirect_pydantic():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Mar 22 01:42:11 UTC 2024 - 237 bytes - Viewed (0) -
tests/test_invalid_sequence_param.py
from typing import Dict, List, Optional, Tuple import pytest from fastapi import FastAPI, Query from pydantic import BaseModel def test_invalid_sequence(): with pytest.raises(AssertionError): app = FastAPI() class Item(BaseModel): title: str @app.get("/items/") def read_items(q: List[Item] = Query(default=None)): pass # pragma: no cover
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri May 13 23:38:22 UTC 2022 - 1.2K bytes - Viewed (0) -
tests/test_security_openid_connect_optional.py
from typing import Optional from fastapi import Depends, FastAPI, Security from fastapi.security.open_id_connect_url import OpenIdConnect from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() oid = OpenIdConnect(openIdConnectUrl="/openid", auto_error=False) class User(BaseModel): username: str def get_current_user(oauth_header: Optional[str] = Security(oid)): if oauth_header is None:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.4K bytes - Viewed (0) -
docs/em/docs/tutorial/testing.md
**FastAPI** 🚚 🎏 `starlette.testclient` `fastapi.testclient` 🏪 👆, 👩💻. ✋️ ⚫️ 👟 🔗 ⚪️➡️ 💃. /// /// tip 🚥 👆 💚 🤙 `async` 🔢 👆 💯 ↖️ ⚪️➡️ 📨 📨 👆 FastAPI 🈸 (✅ 🔁 💽 🔢), ✔️ 👀 [🔁 💯](../advanced/async-tests.md){.internal-link target=_blank} 🏧 🔰. /// ## 🎏 💯 🎰 🈸, 👆 🎲 🔜 ✔️ 👆 💯 🎏 📁. & 👆 **FastAPI** 🈸 5️⃣📆 ✍ 📚 📁/🕹, ♒️. ### **FastAPI** 📱 📁
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5.1K bytes - Viewed (0) -
docs_src/response_model/tutorial003_03.py
from fastapi import FastAPI from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/teleport") async def get_teleport() -> RedirectResponse:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Jan 10 16:22:47 UTC 2023 - 241 bytes - Viewed (0) -
docs/zh/docs/tutorial/dependencies/index.md
注意,无需创建专门的类,并将之传递给 **FastAPI** 以进行「注册」或执行类似的操作。 只要把它传递给 `Depends`,**FastAPI** 就知道该如何执行后续操作。 /// ## 要不要使用 `async`? **FastAPI** 调用依赖项的方式与*路径操作函数*一样,因此,定义依赖项函数,也要应用与路径操作函数相同的规则。 即,既可以使用异步的 `async def`,也可以使用普通的 `def` 定义依赖项。 在普通的 `def` *路径操作函数*中,可以声明异步的 `async def` 依赖项;也可以在异步的 `async def` *路径操作函数*中声明普通的 `def` 依赖项。 上述这些操作都是可行的,**FastAPI** 知道该怎么处理。 /// note | "笔记"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 7K bytes - Viewed (0)