Ubidots Python library asynchronous use


#1

Hello,
I’d like to know if the Ubidots Python API supports asynchronous programming and threading and what is the best way to implement such feature (whether create short lived threads, use aiohttp, etc).

I am trying to develop a people counter that needs to update the reading very frequently, ~1Hz, while the WiFi is laggy. As it is now the people detection algorithm halts for quite a while to wait for Ubidots library to update the variable, I’d like to decommission such task and make it asynchronous or completely separate it from the main loop in a separate thread.
Thank you


#2

Hi there, the easiest way is to use aiohttp to send your requests, just keep in mind that Ubidots supports up to 4 requests per second, so you should send your data in bulk every second.

All the best