Files
railseek6/list_routes.py

14 lines
400 B
Python

import requests
import json
try:
resp = requests.get('http://localhost:8000/openapi.json', timeout=5)
if resp.status_code == 200:
data = resp.json()
print("Available paths:")
for path in sorted(data['paths'].keys()):
print(f" {path}")
else:
print(f"Failed to fetch openapi: {resp.status_code}")
except Exception as e:
print(f"Error: {e}")