ReagentX / purple_air_api

Python package to get and transform PurpleAir data
https://pypi.org/project/purpleair/
GNU General Public License v3.0
50 stars 19 forks source link

Error in retrieving all sensor list #65

Closed convolutionbbs closed 3 years ago

convolutionbbs commented 3 years ago

Hello, Using 1.2.1 and trying to run the demo code to import all the available sensors:

from purpleair.network import SensorList p = SensorList() # Initialized 11,220 sensors!

Other sensor filters include 'outside', 'useful', 'family', and 'no_child'

df = p.to_dataframe(sensor_filter='all', channel='parent')

And it returns:

ValueError: No sensor data returned from PurpleAir: An empty querystring is not permitted. Please contact PurpleAir at contact@purpleair.com for assistance.

Is there another way to do this?

Thanks!

ReagentX commented 3 years ago

I've not seen this error before, perhaps the endpoint changed. I will look into this.

naupaka commented 3 years ago

Same error for me. From what I found elsewhere it sounds like they did change something: https://stackoverflow.com/questions/65030818/javascript-gets-get-https-www-purpleair-com-json-400-bad-request-on-json-r

ReagentX commented 3 years ago

Thanks for the link, looks like this should be a simple patch.

naupaka commented 3 years ago

Looks like it's perhaps related to this shift: https://docs.google.com/document/d/15ijz94dXJ-YAZLi9iZ_RaBwrZ4KtYeCy08goGBwnbCU/edit

The JSON dump of all sensors works at https://www.purpleair.com/data.json

but not at https://www.purpleair.com/json

ReagentX commented 3 years ago

Resolved in v1.2.2 with a temporary fix until api.purpleair.com/v1/ is usable.