0xffan commited on
Commit
cec941e
·
1 Parent(s): e4ba296

Issue fixes

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -44,6 +44,7 @@ def get_aqi(city:str, state:str, country:str)-> str:
44
  """
45
  try:
46
  IQAIR_API_KEY = os.environ["IQAIR_API_KEY"]
 
47
  url = f"http://api.airvisual.com/v2/city?city={city}&state={state}&country={country}&key={IQAIR_API_KEY}"
48
  payload={}
49
  headers = {}
@@ -52,7 +53,7 @@ def get_aqi(city:str, state:str, country:str)-> str:
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.";
 
44
  """
45
  try:
46
  IQAIR_API_KEY = os.environ["IQAIR_API_KEY"]
47
+ # http://api.airvisual.com/v2/city?city=Chengdu&state=Sichuan&country=China&key=2cb6f85b-18f2-453d-a0c4-f060dae8b92c
48
  url = f"http://api.airvisual.com/v2/city?city={city}&state={state}&country={country}&key={IQAIR_API_KEY}"
49
  payload={}
50
  headers = {}
 
53
 
54
  data_json = response.json()
55
  if data_json["status"] == "success":
56
+ aqius = data_json["data"]["current"]["pollution"]["aqius"]
57
  return f"The current air quality in {city} is {aqius}."
58
  else:
59
  return "No air quality data was fetched.";