File size: 573 Bytes
4b81310 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import requests
import logging
class InstancesAPI:
def __init__(self, instances):
self.instances = instances
def fetch_reports(self):
reports = {}
for instance_url in self.instances:
try:
response = requests.get(f"{instance_url}/api/get/report")
response.raise_for_status()
reports[instance_url] = response.json()
except requests.exceptions.RequestException as e:
logging.error(f"Error contacting instance {instance_url}: {e}")
return reports
|