diff --git a/CHANGELOG.md b/CHANGELOG.md index b628405..3ec7da6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.6.18 + +* Added retry mechanism for the authentication flow. + ## v0.6.17 * Removed unnecessary dependencies of the SDK, bumped Pyarrow to v10. diff --git a/railib/__init__.py b/railib/__init__.py index c4de3da..f599a48 100644 --- a/railib/__init__.py +++ b/railib/__init__.py @@ -12,5 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version_info__ = (0, 6, 17) +__version_info__ = (0, 6, 18) __version__ = ".".join(map(str, __version_info__)) diff --git a/railib/rest.py b/railib/rest.py index 77e71da..2b3d199 100644 --- a/railib/rest.py +++ b/railib/rest.py @@ -194,13 +194,15 @@ def _request_access_token(ctx: Context, url: str) -> AccessToken: data=data, ) _print_request(req) - with urlopen(req) as rsp: + with _urlopen_with_retry(req, ctx.retries) as rsp: result = json.loads(rsp.read()) token = result.get(ACCESS_KEY_TOKEN_KEY, None) + if token is not None: expires_in = result.get(EXPIRES_IN_KEY, None) scope = result.get(SCOPE, None) return AccessToken(token, scope, expires_in) + raise Exception("failed to get the access token")