Unable to retrieve data from Thingspeak API (PurpleAir)

1 visualización (últimos 30 días)
Kyongwon Yoo
Kyongwon Yoo el 17 de Mayo de 2022
Comentada: Christopher Stapels el 14 de Oct. de 2022
Hello,
I am having trouble accessing the Thingspeak API with PurpleAir.
Currently my code contains this,
temp_df = pd.read_csv(StringIO(requests.get("https://api.thingspeak.com/channels/"+repr(id)+"/feeds.csv?resutls=8000&api_key="+api+"&end="+end_time).text))
where api_key is retrived from api.purpleair and end_time is for my time period.
Now it just returns -1.
This code worked before for several years however it stopped working today. I assume it blocked me out from accessing the data. How can I fix this?
  3 comentarios
Kyongwon Yoo
Kyongwon Yoo el 19 de Mayo de 2022
I am reading multiple channels (primary_a, primary_b, secondary_a, secondary_b)
Kyongwon Yoo
Kyongwon Yoo el 19 de Mayo de 2022
There was a problem on Thingspeak API, but now the problem is resolved. Thanks.

Iniciar sesión para comentar.

Respuestas (2)

Christopher Stapels
Christopher Stapels el 19 de Mayo de 2022
Thank you for noting that the issue you had is resolved. If you are reading multiple channels, please be sure to use a short delay between each read attempt, so as not to create undue burden on the server.

Frederic Lhoest
Frederic Lhoest el 29 de Sept. de 2022
Hi there,
I have the same issue; using the command line curl command on macOS it works fine.
Same thing with a php cURL function I'm receiving -1 ...
  6 comentarios
Frederic Lhoest
Frederic Lhoest el 12 de Oct. de 2022
All works ! ;)
I created a framework to assist me retrieving data : https://github.com/flhoest/ThingSpeak/blob/main/tsFramework.php
Christopher Stapels
Christopher Stapels el 14 de Oct. de 2022
Thanks for sharing! I made a small pull request to keep people who use the function in a loop from slamming the server.

Iniciar sesión para comentar.

Categorías

Más información sobre Configure Accounts and Channels en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by