Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle error on service not enabled #1117

Merged
merged 1 commit into from Dec 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion googleapiclient/http.py
Expand Up @@ -116,7 +116,9 @@ def _should_retry_response(resp_status, content):
try:
data = json.loads(content.decode("utf-8"))
if isinstance(data, dict):
reason = data["error"]["errors"][0]["reason"]
reason = data["error"].get("status")
if reason is None:
reason = data["error"]["errors"][0]["reason"]
else:
reason = data[0]["error"]["errors"]["reason"]
except (UnicodeDecodeError, ValueError, KeyError):
Expand Down