miczal / aqicn-sdk

aqicn API Python SDK
MIT License
7 stars 2 forks source link

Result data error #1

Open shautzin opened 6 years ago

shautzin commented 6 years ago

Hi, I'm using your apicn-sdk, but no matter which city I pass, it always return data of city:

"name": "Barrie, Ontario"

Something went wrong for the APIs or my code?

miczal commented 6 years ago

Hi!

I didn't use this github account in ages 😄.

Could you provide me with your code?

I will rewrite the whole thing in the weekend - it will be typed and docstrings will be better.

shautzin commented 6 years ago

Here's my test code:

def test():
    api = AqicnApi(secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhidden")
    result = api.get_feed("Suzhou")
    print(result)

And the result is:

{'status': 'ok', 'data': {'idx': 0, 'aqi': 34, 'time': {'v': 1521086400, 's': '2018-03-15 04:00:00', 'tz': '-05:00'}, 'city': {'name': 'Barrie, Ontario', 'url': 'http://aqicn.org/city/canada/ontario/barrie/', 'geo': ['44.382361', '-79.702306']}, 'attributions': [{'name': 'Air Quality Ontario - the Ontario Ministry of the Environment and Climate Change', 'url': 'http://www.airqualityontario.com/'}, {'name': 'World Air Quality Index Project', 'url': 'http://waqi.info/'}], 'iaqi': {'pm25': {'v': 34}, 'o3': {'v': 33}, 'no2': {'v': 5}, 't': {'v': -7}, 'p': {'v': 1003}, 'h': {'v': 92}}}}

But when I use api.get_feed() instead, it's get the right thing.