Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
hkethi002 committed Aug 19, 2021
1 parent 03ca1f0 commit 2454d76
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions starlette_opentracing/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ def __init__(self, app, tracer, use_template: bool = False):
def get_template(self, request: Request) -> str:
"""Get the template for the route endpoint."""
method = request.method
urls = [
route
for route in request.scope["router"].routes
if hasattr(route, "endpoint") and
"endpoint" in request.scope and
route.endpoint == request.scope["endpoint"]
]
if "endpoint" in request.scope:
urls = [
route
for route in request.scope["router"].routes
if hasattr(route, "endpoint") and route.endpoint == request.scope["endpoint"]
]
else:
urls = []

template = urls[0].path if len(urls) > 0 else "UNKNOWN"
method_path = method + " " + template
return method_path
Expand Down

0 comments on commit 2454d76

Please sign in to comment.