Skip to content

Commit

Permalink
Retry on auth refresh error.
Browse files Browse the repository at this point in the history
Retry on requests failing due to `google.auth.exceptions.RefreshError`,
partial resolution of #71.
  • Loading branch information
asford committed Feb 14, 2018
1 parent 94d9bfc commit 205d40f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gcsfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from base64 import b64encode
import google.auth as gauth
from google.auth.transport.requests import AuthorizedSession
import google.auth.exceptions
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from google.oauth2 import service_account
Expand Down Expand Up @@ -391,7 +392,7 @@ def _call(self, method, path, *args, **kwargs):
r = meth(self.base + path, params=kwargs, json=json)
validate_response(r, path)
break
except (HtmlError, RequestException) as e:
except (HtmlError, RequestException, google.auth.exceptions.RefreshError) as e:
logger.exception("_call exception: %s", e)
if retry == self.retries - 1:
raise e
Expand Down

0 comments on commit 205d40f

Please sign in to comment.