feat: better error handling & feedback

This commit is contained in:
2024-02-09 17:18:52 +01:00
parent c752f0ab89
commit 1dc3a4671a
3 changed files with 39 additions and 7 deletions

View File

@@ -61,7 +61,6 @@ def downloadFlugfeldData(fromTime, toTime, dtype):
# check response code #
if r.status_code != 200 or "nicht gefunden" in r.text.lower():
print("Flugfeld kapott")
content = fallback_csv.generate("./dwd", fromTime, toTime, cacheFile, dtype)
else:
content = r.content.decode('utf-8', "ignore") # ignore bad bytes
@@ -101,8 +100,6 @@ def checkLastMonths(backwardsMonths=6):
if start > end:
return ""
print(start, end)
for dtype in dtypes:
content = downloadFlugfeldData(start, end, dtype)
dataList = parse(content, dtype)