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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent exception for JSONDecode error #6097

Merged
merged 1 commit into from
Mar 28, 2022

Conversation

nateprewitt
Copy link
Member

This PR should address #6084 by adding appropriate handling for alternative utf encodings. The previous change in #5856 only accounted for the happy path where we would attempt to load directly from .text. This patch will now ensure we're also catching and raising the appropriate exception when we guess the encoding based on byte sequencing.

When calling .json() it was possible to raise a
requests.exceptions.JSONDecodeError or ValueError
depending on whether the encoding is set.
@nateprewitt nateprewitt merged commit 2d55176 into psf:main Mar 28, 2022
@nateprewitt nateprewitt deleted the json_handling branch March 28, 2022 18:51
@nateprewitt nateprewitt added this to the 2.28.0 milestone Apr 7, 2022
@nateprewitt nateprewitt mentioned this pull request Jun 8, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants