- Sort Score
- Num 10 results
- Language All
Results 251 - 260 of 795 for asyncId (0.05 seconds)
-
tests/test_form_default.py
from fastapi import FastAPI, File, Form from starlette.testclient import TestClient app = FastAPI() @app.post("/urlencoded") async def post_url_encoded(age: Annotated[int | None, Form()] = None): return age @app.post("/multipart") async def post_multi_part( age: Annotated[int | None, Form()] = None, file: Annotated[bytes | None, File()] = None, ): return {"file": file, "age": age}
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 829 bytes - Click Count (0) -
tests/test_request_params/test_body/test_required_str.py
# Without aliases @app.post("/required-str", operation_id="required_str") async def read_required_str(p: Annotated[str, Body(embed=True)]): return {"p": p} class BodyModelRequiredStr(BaseModel): p: str @app.post("/model-required-str", operation_id="model_required_str") async def read_model_required_str(p: BodyModelRequiredStr): return {"p": p.p} @pytest.mark.parametrize(
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 10.9K bytes - Click Count (0) -
tests/test_request_params/test_file/test_optional_list.py
# Without aliases @app.post("/optional-list-bytes") async def read_optional_list_bytes(p: Annotated[list[bytes] | None, File()] = None): return {"file_size": [len(file) for file in p] if p else None} @app.post("/optional-list-uploadfile") async def read_optional_list_uploadfile( p: Annotated[list[UploadFile] | None, File()] = None, ):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sat Feb 21 13:01:31 GMT 2026 - 10.8K bytes - Click Count (0) -
tests/test_request_params/test_cookie/test_optional_str.py
# Without aliases @app.get("/optional-str") async def read_optional_str(p: Annotated[str | None, Cookie()] = None): return {"p": p} class CookieModelOptionalStr(BaseModel): p: str | None = None @app.get("/model-optional-str") async def read_model_optional_str(p: Annotated[CookieModelOptionalStr, Cookie()]): return {"p": p.p}
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 8.6K bytes - Click Count (0) -
docs/zh/docs/tutorial/request-files.md
`UploadFile` 具有以下 `async` 方法。它们都会在底层调用对应的文件方法(使用内部的 `SpooledTemporaryFile`)。 * `write(data)`:将 `data` (`str` 或 `bytes`) 写入文件。 * `read(size)`:读取文件中 `size` (`int`) 个字节/字符。 * `seek(offset)`:移动到文件中字节位置 `offset` (`int`)。 * 例如,`await myfile.seek(0)` 会移动到文件开头。 * 如果你先运行过 `await myfile.read()`,然后需要再次读取内容时,这尤其有用。 * `close()`:关闭文件。 由于这些方法都是 `async` 方法,你需要对它们使用 await。 例如,在 `async` *路径操作函数* 内,你可以这样获取内容:Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 6.8K bytes - Click Count (0) -
fastapi/security/http.py
return HTTPException( status_code=HTTP_401_UNAUTHORIZED, detail="Not authenticated", headers=self.make_authenticate_headers(), ) async def __call__(self, request: Request) -> HTTPAuthorizationCredentials | None: authorization = request.headers.get("Authorization") scheme, credentials = get_authorization_scheme_param(authorization)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Mar 16 10:16:48 GMT 2026 - 13.1K bytes - Click Count (0) -
tests/test_additional_responses_response_class.py
@app.get( "/a", response_class=JsonApiResponse, responses={500: {"description": "Error", "model": JsonApiError}}, ) async def a(): pass # pragma: no cover @app.get("/b", responses={500: {"description": "Error", "model": Error}}) async def b(): pass # pragma: no cover client = TestClient(app) def test_openapi_schema(): response = client.get("/openapi.json")
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 3.8K bytes - Click Count (0) -
tests/test_dependency_after_yield_websockets.py
BrokenSessionDep = Annotated[Session, Depends(broken_dep_session)] app = FastAPI() @app.websocket("/ws") async def websocket_endpoint(websocket: WebSocket, session: SessionDep): await websocket.accept() for item in session: await websocket.send_text(f"{item}") @app.websocket("/ws-broken") async def websocket_endpoint_broken(websocket: WebSocket, session: BrokenSessionDep): await websocket.accept()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 17 21:25:59 GMT 2025 - 2K bytes - Click Count (0) -
docs/ja/docs/tutorial/stream-json-lines.md
送り返す各 JSON アイテムが `Item`(Pydantic モデル)型で、関数が async の場合、戻り値の型を `AsyncIterable[Item]` と宣言できます: {* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[1:24] hl[9:11,22] *} 戻り値の型を宣言すると、FastAPI はそれを使ってデータを**検証**し、OpenAPI に**ドキュメント化**し、**フィルター**し、Pydantic で**シリアライズ**します。 /// tip | 豆知識 Pydantic は **Rust** 側でシリアライズを行うため、戻り値の型を宣言しない場合に比べて大幅に高い**パフォーマンス**が得られます。 ///Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:55:22 GMT 2026 - 5.1K bytes - Click Count (0) -
docs_src/websockets_/tutorial001_py310.py
input.value = '' event.preventDefault() } </script> </body> </html> """ @app.get("/") async def get(): return HTMLResponse(html) @app.websocket("/ws") async def websocket_endpoint(websocket: WebSocket): await websocket.accept() while True: data = await websocket.receive_text()Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Feb 27 12:34:37 GMT 2026 - 1.4K bytes - Click Count (0)