From: Roland Häder Date: Tue, 4 Jul 2023 17:18:27 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f6890ed3234a205c28a8ac9fe0a7d1ddc3fe2b76;p=fba.git Continued: - if response is not okay, throw exception - avoids init of domain_data variable --- diff --git a/daemon.py b/daemon.py index 89b288f..2f2e328 100755 --- a/daemon.py +++ b/daemon.py @@ -342,9 +342,10 @@ def rss(request: Request, domain: str): 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")