]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 4 Jul 2023 17:18:27 +0000 (19:18 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 4 Jul 2023 17:18:27 +0000 (19:18 +0200)
- if response is not okay, throw exception
- avoids init of domain_data variable

daemon.py

index 89b288fc5216082a6bfd1f86afbe5dc4c0aa520a..2f2e32837acd9fe68136ed00ec9e2221f3baff87 100755 (executable)
--- 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")