- Sort Score
- Result 10 results
- Languages All
Results 181 - 190 of 855 for asyncpg (0.06 sec)
-
tests/test_response_code_no_body.py
@app.get( "/a", status_code=204, response_class=JsonApiResponse, responses={500: {"description": "Error", "model": JsonApiError}}, ) async def a(): pass @app.get("/b", responses={204: {"description": "No Content"}}) async def b(): pass # pragma: no cover client = TestClient(app) def test_get_response(): response = client.get("/a")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.2K bytes - Viewed (0) -
docs/zh/docs/tutorial/testing.md
``` /// tip | "提示" 注意测试函数是普通的 `def`,不是 `async def`。 还有client的调用也是普通的调用,不是用 `await`。 这让你可以直接使用 `pytest` 而不会遇到麻烦。 /// /// note | "技术细节" 你也可以用 `from starlette.testclient import TestClient`。 **FastAPI** 提供了和 `starlette.testclient` 一样的 `fastapi.testclient`,只是为了方便开发者。但它直接来自Starlette。 /// /// tip | "提示"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6K bytes - Viewed (0) -
docs/de/docs/tutorial/request-files.md
* `close()`: Schließt die Datei. Da alle diese Methoden `async`hron sind, müssen Sie sie `await`en („erwarten“). Zum Beispiel können Sie innerhalb einer `async` *Pfadoperation-Funktion* den Inhalt wie folgt auslesen: ```Python contents = await myfile.read() ```
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 11.3K bytes - Viewed (0) -
tests/test_response_model_data_filter.py
name: str owner: UserDB class PetOut(BaseModel): name: str owner: UserBase @app.post("/users/", response_model=UserBase) async def create_user(user: UserCreate): return user @app.get("/pets/{pet_id}", response_model=PetOut) async def read_pet(pet_id: int): user = UserDB( email="******@****.***", hashed_password="secrethashed", )
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 1.7K bytes - Viewed (0) -
docs_src/app_testing/app_b_an_py310/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.1K bytes - Viewed (0) -
docs/uk/docs/index.md
<summary>Або використайте <code>async def</code>...</summary> Якщо ваш код використовує `async` / `await`, скористайтеся `async def`: ```Python hl_lines="9 14" from typing import Union from fastapi import FastAPI app = FastAPI() @app.get("/") async def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 20 19:20:23 UTC 2024 - 24.2K bytes - Viewed (0) -
tests/test_param_include_in_schema.py
from fastapi.testclient import TestClient app = FastAPI() @app.get("/hidden_cookie") async def hidden_cookie( hidden_cookie: Optional[str] = Cookie(default=None, include_in_schema=False), ): return {"hidden_cookie": hidden_cookie} @app.get("/hidden_header") async def hidden_header( hidden_header: Optional[str] = Header(default=None, include_in_schema=False), ):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Mar 26 16:56:53 UTC 2024 - 7.4K bytes - Viewed (0) -
tests/test_dependency_contextvars.py
) app = FastAPI() async def set_up_request_state_dependency(): request_state = {"user": "deadpond"} contextvar_token = legacy_request_state_context_var.set(request_state) yield request_state legacy_request_state_context_var.reset(contextvar_token) @app.middleware("http") async def custom_middleware(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Feb 17 12:40:12 UTC 2022 - 1.5K bytes - Viewed (0) -
docs_src/app_testing/app_b/main.py
@app.get("/items/{item_id}", response_model=Item) async def read_main(item_id: str, x_token: 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) async def create_item(item: Item, x_token: str = Header()):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Jan 09 14:44:08 UTC 2024 - 1.1K bytes - Viewed (0) -
fastapi/routing.py
original_context: Lifespan[Any], nested_context: Lifespan[Any] ) -> Lifespan[Any]: @asynccontextmanager async def merged_lifespan( app: AppType, ) -> AsyncIterator[Optional[Mapping[str, Any]]]: async with original_context(app) as maybe_original_state: async with nested_context(app) as maybe_nested_state: if maybe_nested_state is None and maybe_original_state is None:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Oct 12 09:44:57 UTC 2024 - 172.1K bytes - Viewed (0)