- Sort Score
- Result 10 results
- Languages All
Results 571 - 580 of 1,127 for def2 (0.03 sec)
-
tests/test_tutorial/test_extending_openapi/test_tutorial001.py
from fastapi.testclient import TestClient from docs_src.extending_openapi.tutorial001 import app client = TestClient(app) def test(): response = client.get("/items/") assert response.status_code == 200, response.text assert response.json() == [{"name": "Foo"}] def test_openapi_schema(): response = client.get("/openapi.json") assert response.status_code == 200, response.text assert response.json() == {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.5K bytes - Viewed (0) -
tests/test_tutorial/test_openapi_callbacks/test_tutorial001.py
client = TestClient(app) def test_get(): response = client.post( "/invoices/", json={"id": "fooinvoice", "customer": "John", "total": 5.3} ) assert response.status_code == 200, response.text assert response.json() == {"msg": "Invoice received"} def test_dummy_callback(): # Just for coverage invoice_notification({}) def test_openapi_schema():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 9K bytes - Viewed (0) -
tests/test_tutorial/test_response_model/test_tutorial004.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Aug 04 20:47:07 UTC 2023 - 5K bytes - Viewed (0) -
docs/de/docs/tutorial/dependencies/index.md
Sie können `async def` oder einfach `def` verwenden. Und Sie können Abhängigkeiten mit `async def` innerhalb normaler `def`-*Pfadoperation-Funktionen* oder `def`-Abhängigkeiten innerhalb von `async def`-*Pfadoperation-Funktionen*, usw. deklarieren. Es spielt keine Rolle. **FastAPI** weiß, was zu tun ist. /// note | "Hinweis"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 13K bytes - Viewed (0) -
docs_src/app_testing/app_b_an/main.py
@app.get("/items/{item_id}", response_model=Item) async def read_main(item_id: str, x_token: Annotated[str, Header()]): if x_token != fake_secret_token: raise HTTPException(status_code=400, detail="Invalid X-Token header") if item_id not in fake_db: raise HTTPException(status_code=404, detail="Item not found") return fake_db[item_id] @app.post("/items/", response_model=Item)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Aug 15 22:31:16 UTC 2024 - 1.2K bytes - Viewed (0) -
fastapi/param_functions.py
from fastapi import Depends, FastAPI app = FastAPI() async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100): return {"q": q, "skip": skip, "limit": limit} @app.get("/items/") async def read_items(commons: Annotated[dict, Depends(common_parameters)]): return commons ``` """
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 23 18:30:18 UTC 2024 - 62.5K bytes - Viewed (0) -
okhttp/src/test/java/okhttp3/CallTest.kt
Request( url = server.url("/"), body = "def".toRequestBody("text/plain".toMediaType()), ) executeSynchronously(request) .assertCode(200) .assertBody("abc") val recordedRequest = server.takeRequest() assertThat(recordedRequest.method).isEqualTo("POST") assertThat(recordedRequest.body.readUtf8()).isEqualTo("def") assertThat(recordedRequest.headers["Content-Length"]).isEqualTo("3")
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Wed Apr 10 19:46:48 UTC 2024 - 142.5K bytes - Viewed (0) -
tests/test_tutorial/test_metadata/test_tutorial001.py
from fastapi.testclient import TestClient from docs_src.metadata.tutorial001 import app client = TestClient(app) def test_items(): response = client.get("/items/") assert response.status_code == 200, response.text assert response.json() == [{"name": "Katana"}] def test_openapi_schema(): response = client.get("/openapi.json") assert response.status_code == 200, response.text assert response.json() == {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.7K bytes - Viewed (0) -
docs/zh/docs/tutorial/background-tasks.md
``` **FastAPI** 会创建一个 `BackgroundTasks` 类型的对象并作为该参数传入。 ## 创建一个任务函数 创建要作为后台任务运行的函数。 它只是一个可以接收参数的标准函数。 它可以是 `async def` 或普通的 `def` 函数,**FastAPI** 知道如何正确处理。 在这种情况下,任务函数将写入一个文件(模拟发送电子邮件)。 由于写操作不使用 `async` 和 `await`,我们用普通的 `def` 定义函数: ```Python hl_lines="6-9" {!../../docs_src/background_tasks/tutorial001.py!} ``` ## 添加后台任务 在你的 *路径操作函数* 里,用 `.add_task()` 方法将任务函数传到 *后台任务* 对象中:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5K bytes - Viewed (0) -
tests/test_tutorial/test_sql_databases/test_tutorial001.py
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 SQLModel.metadata.clear() # Clear the Models associated with the registry, to avoid warnings default_registry.dispose()
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 14.8K bytes - Viewed (0)