This commit is contained in:
Jay Lee
2019-12-19 13:44:07 -05:00
parent a0c410be0e
commit 6248958c94
2 changed files with 11 additions and 0 deletions

View File

@@ -1081,6 +1081,12 @@ def getValidOauth2TxtCredentials(force_refresh=False):
writeCredentials(credentials)
break
except google.auth.exceptions.RefreshError as e:
try:
if e.args[0] in REFRESH_PERM_ERRORS:
# remove OAuth file so we kick off auth next time
os.remove(GC_Values[GC_OAUTH2_TXT])
except SyntaxError:
pass
controlflow.system_error_exit(18, str(e))
except (google.auth.exceptions.TransportError, httplib2.ServerNotFoundError, RuntimeError) as e:
if n != retries:

View File

@@ -450,6 +450,11 @@ DOCUMENT_FORMATS_MAP = {
{'mime': 'application/vnd.oasis.opendocument.text', 'ext': '.odt'}],
}
REFRESH_PERM_ERRORS = [
'invalid_grant: reauth related error (rapt_required)', # no way to reauth today
'invalid_grant: Token has been expired or revoked.',
]
DNS_ERROR_CODES_MAP = {
1: 'DNS Query Format Error',
2: 'Server failed to complete the DNS request',