Spaces:
Sleeping
Sleeping
Issue fixes
Browse files
app.py
CHANGED
@@ -51,8 +51,9 @@ def get_aqi(city:str, state:str, country:str)-> str:
|
|
51 |
response = requests.request("GET", url, headers=headers, data=payload)
|
52 |
|
53 |
data_json = response.json()
|
54 |
-
if data_json
|
55 |
-
|
|
|
56 |
else:
|
57 |
return "No air quality data was fetched.";
|
58 |
|
|
|
51 |
response = requests.request("GET", url, headers=headers, data=payload)
|
52 |
|
53 |
data_json = response.json()
|
54 |
+
if data_json["status"] == "success":
|
55 |
+
aqius = data_json["current"]["pollution"]["aqius"]
|
56 |
+
return f"The current air quality in {city} is {aqius}."
|
57 |
else:
|
58 |
return "No air quality data was fetched.";
|
59 |
|