Skip to content

Commit

Permalink
reauthenticate on unexpected 401 errors, fix of marazmiki#10
Browse files Browse the repository at this point in the history
  • Loading branch information
idealatom committed Apr 28, 2020
1 parent 7eead23 commit fa1d52a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions django_selectel_storage/selectel.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def perform_request(self, http_method, key,
self.build_url(key),
**kwargs
) # type: requests.Response
if resp.status_code == 401:
log.debug('Got an unexpected 401 error, reauthenticate.')
self.authenticate()
return self.perform_request(http_method, key, raise_exception, **kwargs)
if raise_exception:
resp.raise_for_status()
return resp
Expand Down

0 comments on commit fa1d52a

Please sign in to comment.