def _retry_api_check(exception):
"""Return True if we should retry. False otherwise.
Args:
exception: An exception to test for transience.
Returns:
True if we should retry. False otherwise.
"""
_print_error('Exception %s: %s' % (type(exception).__name__, str(exception)))
if isinstance(exception, apiclient.errors.HttpError):
if exception.resp.status in TRANSIENT_HTTP_ERROR_CODES:
return True
if isinstance(exception, socket.error):
if exception.errno in TRANSIENT_SOCKET_ERROR_CODES:
return True
if isinstance(exception, HttpAccessTokenRefreshError):
return True
return False
评论列表
文章目录