Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion google/oauth2/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ def _token_endpoint_request(request, token_uri, body):
if hasattr(response.data, "decode")
else response.data
)
response_data = json.loads(response_body)
try:
response_data = json.loads(response_body)
except (KeyError, ValueError):
Copy link
Copy Markdown
Contributor

@mik-laj mik-laj Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
except (KeyError, ValueError):
except json.DecodeError:

WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a Python3-only change, i think.

# raise if the response can't be json decoded.
error_details = response_body
raise exceptions.RefreshError(error_details, response_body)


if response.status == http_client.OK:
break
Expand Down