adobe-apiplatform / umapi-client.py

Python client for the User Management API (UMAPI) from Adobe
https://developer.adobe.com/umapi/
MIT License
12 stars 19 forks source link

Treat connection error like a timeout #79

Closed adorton-adobe closed 4 years ago

adorton-adobe commented 4 years ago

We've been advised by the UMAPI/JIL team that the API gateway will sometimes refuse connections. The UMAPI client should treat these connection errors like a timeout and wait a random amount of time and try again with exponential backoff.

I've refactored the API response handling logic so that a response from the requests call is wrapped in an APIResult object which provides which checks the response for a retry timestamp or delta. It also checks for certain response codes that represent fatal errors. In the cases of request.Timeout and request.ConnectionError errors, we can construct an APIResult object with no underlying response so the timeout logic will handle those cases.