Read http status code from response object

This commit is contained in:
Marius Alwan Meyer 2023-09-29 13:29:06 +02:00
parent 55fdfc2c8d
commit 20a153e857

View File

@ -15,7 +15,7 @@ response = requests.get(complete_url)
data = response.json()
if data["cod"] != "404":
if response.status_code == 200:
info_main = data["main"]
info_weather = data["weather"]
@ -40,4 +40,5 @@ if data["cod"] != "404":
]))
else:
print(" City Not Found ")
print(f"Fehler: {response.status_code}")
print(response.text)