I have built a script that implements an MQTT client based on the pytapo (getEvents) method. The script keeps on interrogating my camera in search of a new event but also manages the MQTT keepalive with the broker. So it is essential that the getEvents interrogation is not locking the entire processing.
Unfortunately, I found that my camera has very unsteady response times (most of the time response in a few seconds but sometimes response time is greater than 30 seconds). The greatest response times cause my MQTT connection to break.
I have dig in the pytapo code and noticed that it makes calls to the "requests" package and that most of the requests class methods are able to handle a "timeout" parameter. BTW, I totally agree with what is written in the requests documentation "Most requests to external servers should have a timeout attached, in case the server is not responding in a timely manner.".
I have tested a quick and dirty patch in the pytapo code:
Is it possible to have a clean implementation of the requests timeout in the pytapo package?
I have built a script that implements an MQTT client based on the pytapo (getEvents) method. The script keeps on interrogating my camera in search of a new event but also manages the MQTT keepalive with the broker. So it is essential that the getEvents interrogation is not locking the entire processing. Unfortunately, I found that my camera has very unsteady response times (most of the time response in a few seconds but sometimes response time is greater than 30 seconds). The greatest response times cause my MQTT connection to break. I have dig in the pytapo code and noticed that it makes calls to the "requests" package and that most of the requests class methods are able to handle a "timeout" parameter. BTW, I totally agree with what is written in the requests documentation "Most requests to external servers should have a timeout attached, in case the server is not responding in a timely manner.". I have tested a quick and dirty patch in the pytapo code:
Is it possible to have a clean implementation of the requests timeout in the pytapo package?