whisper.api / app /utils /utils.py
Ved Gupta
things gonna change
9d9b02c
raw
history blame
710 Bytes
import json
def get_all_routes(app):
routes = []
for route in app.routes:
routes.append(
{
"path": route.path,
"name": route.name,
"methods": list(route.methods),
}
)
return routes
def print_routes(app):
routes = get_all_routes(app)
print("\n\n")
print("Path" + " " * 45 + "Name" + " " * 45 + "Methods")
print("-" * 105)
for route in routes:
print(
f"{route['path']}"
+ " " * (48 - len(route["path"]))
+ f"{route['name']}"
+ " " * (48 - len(route["name"]))
+ f"{', '.join(route['methods'])}"
)
print("\n")