- if response is not okay, throw exception
- avoids init of domain_data variable
response = requests.get(f"http://{config.get('host')}:{config.get('port')}{config.get('base_url')}/api/domain.json?domain={domain}")
- domain_data = dict()
- if response is not None and response.ok:
- domain_data = response.json()
+ if not response.ok or response.status_code > 200 or response.text.strip() == "":
+ raise HTTPException(status_code=response.status_code, detail=response.reason)
+
+ domain_data = response.json()
# Format timestamps
format = config.get("timestamp_format")