Skip to content

Commit c3d30e7

Browse files
author
Anatoli Kurtsevich
authored
RAI-17706 Added retry mechanism to the retry flow (#139)
* added retry mechanism to the retry flow * wrapped _urlopen_with_retry into with to close the response once read
1 parent 8897fb6 commit c3d30e7

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.6.18
4+
5+
* Added retry mechanism for the authentication flow.
6+
37
## v0.6.17
48

59
* Removed unnecessary dependencies of the SDK, bumped Pyarrow to v10.

railib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version_info__ = (0, 6, 17)
15+
__version_info__ = (0, 6, 18)
1616
__version__ = ".".join(map(str, __version_info__))

railib/rest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,13 +194,15 @@ def _request_access_token(ctx: Context, url: str) -> AccessToken:
194194
data=data,
195195
)
196196
_print_request(req)
197-
with urlopen(req) as rsp:
197+
with _urlopen_with_retry(req, ctx.retries) as rsp:
198198
result = json.loads(rsp.read())
199199
token = result.get(ACCESS_KEY_TOKEN_KEY, None)
200+
200201
if token is not None:
201202
expires_in = result.get(EXPIRES_IN_KEY, None)
202203
scope = result.get(SCOPE, None)
203204
return AccessToken(token, scope, expires_in)
205+
204206
raise Exception("failed to get the access token")
205207

206208

0 commit comments

Comments
 (0)