- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 360 for router (0.04 sec)
-
tests/test_generate_unique_id_function.py
from fastapi.testclient import TestClient from pydantic import BaseModel def custom_generate_unique_id(route: APIRoute): return f"foo_{route.name}" def custom_generate_unique_id2(route: APIRoute): return f"bar_{route.name}" def custom_generate_unique_id3(route: APIRoute): return f"baz_{route.name}" class Item(BaseModel): name: str price: float class Message(BaseModel):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 66.7K bytes - Viewed (0) -
docs/de/docs/tutorial/bigger-applications.md
Wir importieren das Submodul `items` direkt, anstatt nur seine Variable `router` zu importieren. Das liegt daran, dass wir im Submodul `users` auch eine weitere Variable namens `router` haben. Wenn wir eine nach der anderen importiert hätten, etwa: ```Python from .routers.items import router from .routers.users import router ```
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 10 13:54:34 UTC 2025 - 21.3K bytes - Viewed (0) -
tests/test_ws_router.py
await websocket.close() @router.websocket("/router/{pathparam:path}") async def routerindexparams(websocket: WebSocket, pathparam: str, queryparam: str): await websocket.accept() await websocket.send_text(pathparam) await websocket.send_text(queryparam) await websocket.close() async def ws_dependency(): return "Socket Dependency" @router.websocket("/router-ws-depends/")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sun Jun 11 19:08:14 UTC 2023 - 7.5K bytes - Viewed (0) -
docs/en/docs/tutorial/bigger-applications.md
We are importing the submodule `items` directly, instead of importing just its variable `router`. This is because we also have another variable named `router` in the submodule `users`. If we had imported one after the other, like: ```Python from .routers.items import router from .routers.users import router ```
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 10 08:55:32 UTC 2025 - 18.6K bytes - Viewed (0) -
tests/test_dependency_overrides.py
@router.get("/router-depends/") async def router_depends(commons: dict = Depends(common_parameters)): return {"in": "router-depends", "params": commons} @router.get("/router-decorator-depends/", dependencies=[Depends(common_parameters)]) async def router_decorator_depends(): return {"in": "router-decorator-depends"} app.include_router(router) client = TestClient(app)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 11.2K bytes - Viewed (0) -
tests/test_ws_dependencies.py
assert data == ["app", "index"] def test_routerindex(): client = TestClient(app) with client.websocket_connect("/router") as websocket: data = json.loads(websocket.receive_text()) assert data == ["app", "router2", "router", "routerindex"] def test_routerprefixindex(): client = TestClient(app) with client.websocket_connect("/prefix/") as websocket:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 2.1K bytes - Viewed (0) -
tests/test_custom_route_class.py
@router_b.get("/") def get_b(): return {"msg": "B"} @router_c.get("/") def get_c(): return {"msg": "C"} router_b.include_router(router=router_c, prefix="/c") router_a.include_router(router=router_b, prefix="/b") app.include_router(router=router_a, prefix="/a") client = TestClient(app) @pytest.mark.parametrize( "path,expected_status,expected_response", [
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.1K bytes - Viewed (0) -
tests/test_include_route.py
from fastapi.responses import JSONResponse from fastapi.testclient import TestClient app = FastAPI() router = APIRouter() @router.route("/items/") def read_items(request: Request): return JSONResponse({"hello": "world"}) app.include_router(router) client = TestClient(app) def test_sub_router(): response = client.get("/items/")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Apr 08 04:37:38 UTC 2020 - 496 bytes - Viewed (0) -
docs_src/custom_request_and_route/tutorial003_py310.py
response.headers["X-Response-Time"] = str(duration) print(f"route duration: {duration}") print(f"route response: {response}") print(f"route response headers: {response.headers}") return response return custom_route_handler app = FastAPI() router = APIRouter(route_class=TimedRoute) @app.get("/") async def not_timed():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 10 08:55:32 UTC 2025 - 1K bytes - Viewed (0) -
docs/es/docs/tutorial/bigger-applications.md
Estamos importando el submódulo `items` directamente, en lugar de importar solo su variable `router`. Esto se debe a que también tenemos otra variable llamada `router` en el submódulo `users`. Si hubiéramos importado uno después del otro, como: ```Python from .routers.items import router from .routers.users import router ``` el `router` de `users` sobrescribiría el de `items` y no podríamos usarlos al mismo tiempo.
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Dec 16 16:33:45 UTC 2025 - 19.6K bytes - Viewed (0)