Skip to content

Commit fcd5f15

Browse files
authored
Merge pull request #64 from mapr/MAPRDB-2230
Fixed token renewal logic Updated version
2 parents 9040c75 + c0f096c commit fcd5f15

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

mapr/ojai/storage/OJAIConnection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def is_store_exists(self, store_path):
176176
elif response.error.err_code == ErrorCode.Value('TABLE_NOT_FOUND'):
177177
return False
178178
else:
179-
raise UnknownServerError
179+
raise UnknownServerError(m=response.error.error_message)
180180

181181
def delete_store(self, store_path):
182182
self.__validate_store_path(store_path=store_path)

mapr/ojai/storage/auth_interceptor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def metadata_builder(self):
4949
value = 'basic {0}'.format(self._encoded_user_creds)
5050
else:
5151
value = 'bearer {0}'.format(self._token)
52+
self._token = None
5253
return 'authorization', value
5354

5455
def set_jwt_token(self, call, stream=False):

mapr/ojai/utils/retry_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ def __init__(self,
3131
# Retry checker function
3232
def retry_if_connection_not_established(exception):
3333
if isinstance(exception, _Rendezvous):
34-
return exception.code() == StatusCode.UNAVAILABLE or exception.code() == StatusCode.RESOURCE_EXHAUSTED
34+
if exception.code() == StatusCode.UNAUTHENTICATED \
35+
and exception.details() == 'STATUS_TOKEN_EXPIRED':
36+
return True
37+
else:
38+
return exception.code() == StatusCode.UNAVAILABLE \
39+
or exception.code() == StatusCode.RESOURCE_EXHAUSTED
3540
elif isinstance(exception, ExpiredTokenError):
3641
return True
3742
else:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
setup(name='maprdb_python_client',
5-
version='1.1.2',
5+
version='1.1.3',
66
description='MapR-DB Python Client',
77
url='https://github.com/mapr/maprdb-python-client/',
88
author='MapR, Inc.',

0 commit comments

Comments
 (0)