TimedRoute Class — fastapi Architecture
Architecture documentation for the TimedRoute class in tutorial003_py310.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 2152a884_3ef1_bb8b_7208_01baaa0fdc45["TimedRoute"] aa28685f_bb97_e988_ff40_3e5385960f32["APIRoute"] 2152a884_3ef1_bb8b_7208_01baaa0fdc45 -->|extends| aa28685f_bb97_e988_ff40_3e5385960f32 9dc29258_63d8_2a6a_b7bd_2461b5eff8ea["tutorial003_py310.py"] 2152a884_3ef1_bb8b_7208_01baaa0fdc45 -->|defined in| 9dc29258_63d8_2a6a_b7bd_2461b5eff8ea 76b9112c_e10c_9fec_0fa2_a748d4271bb6["get_route_handler()"] 2152a884_3ef1_bb8b_7208_01baaa0fdc45 -->|method| 76b9112c_e10c_9fec_0fa2_a748d4271bb6
Relationship Graph
Source Code
docs_src/custom_request_and_route/tutorial003_py310.py lines 8–22
class TimedRoute(APIRoute):
def get_route_handler(self) -> Callable:
original_route_handler = super().get_route_handler()
async def custom_route_handler(request: Request) -> Response:
before = time.time()
response: Response = await original_route_handler(request)
duration = time.time() - before
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
Domain
Extends
Source
Frequently Asked Questions
What is the TimedRoute class?
TimedRoute is a class in the fastapi codebase, defined in docs_src/custom_request_and_route/tutorial003_py310.py.
Where is TimedRoute defined?
TimedRoute is defined in docs_src/custom_request_and_route/tutorial003_py310.py at line 8.
What does TimedRoute extend?
TimedRoute extends APIRoute.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free