Closed davidhuser closed 3 years ago
Implemented in v2.2.0 with a default of 5 seconds, and in v2.2.1 with a no default value again.
Nearly all production code should use this parameter in nearly all requests.
If you face errors such as:
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='play.dhis2.org/demo', port=443): Read timed out. (read timeout=5)
You can improve your code by setting your own appropriate timeout values by overwriting the timeout
parameter in seconds:
from dhis2 import Api
api = Api('play.dhis2.org/demo', 'admin', 'district')
r = api.get('endPoint', timeout=60) # <-- see here
data = r.json()
implement optional parameter for https://requests.readthedocs.io/en/master/user/quickstart/#timeouts
at https://github.com/davidhuser/dhis2.py/blob/master/dhis2/api.py#L202