I'd like to propose a change where refresh_tokens can be called from within the
library's request calls. The following code will watch for an ExpiredTokenError.
If this exception is seen the request call will kick the refresh_tokens and try the
request again. If the second call fails the exception will be passed up the stack.
This is handled by a wrapper function around the _request call. This way the
authentication and token handling can still use the existing logic.
This change handles much of the token expiration behind the scenes, eliminating
many of the issues when expired tokens can sit waiting until the next refresh
to renew those tokens.
This PR also bumps up the requests version in the install_requires list. The existing
version 2.0 is about 8 years old.
I'd like to propose a change where refresh_tokens can be called from within the library's request calls. The following code will watch for an ExpiredTokenError. If this exception is seen the request call will kick the refresh_tokens and try the request again. If the second call fails the exception will be passed up the stack. This is handled by a wrapper function around the _request call. This way the authentication and token handling can still use the existing logic.
This change handles much of the token expiration behind the scenes, eliminating many of the issues when expired tokens can sit waiting until the next refresh to renew those tokens.
This PR also bumps up the requests version in the install_requires list. The existing version 2.0 is about 8 years old.