Read http status code from response object
This commit is contained in:
parent
55fdfc2c8d
commit
20a153e857
@ -15,7 +15,7 @@ response = requests.get(complete_url)
|
|||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
if data["cod"] != "404":
|
if response.status_code == 200:
|
||||||
|
|
||||||
info_main = data["main"]
|
info_main = data["main"]
|
||||||
info_weather = data["weather"]
|
info_weather = data["weather"]
|
||||||
@ -40,4 +40,5 @@ if data["cod"] != "404":
|
|||||||
]))
|
]))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(" City Not Found ")
|
print(f"Fehler: {response.status_code}")
|
||||||
|
print(response.text)
|
||||||
|
Loading…
Reference in New Issue
Block a user