-
Notifications
You must be signed in to change notification settings - Fork 48
Fixed encoding bug in python3 #13
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
Conversation
… python3 - Happens because python3 HTTPResponse, when read like a file (e.g. with `json.load`), assumes binary - see: https://stackoverflow.com/questions/23049767/parsing-http-response-in-python - Updated test mocks to make unit tests pass
2 similar comments
|
I'm trying to use jupyter-enterprise-gateway, which depends on this project, and am also encountering this issue. |
| class Response(object): | ||
| def __init__(self, http_response): | ||
| self.data = json.load(http_response) | ||
| self.data = json.loads(http_response.read().decode(http_response.headers.get_content_charset('utf-8'))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how it's implemented in #7 , but there content charset is not taken into account.
Perhaps use codecs module in combination with http_response.headers.get_content_charset('utf-8') ?
|
@adamkewley please rebase from master and bump version as well |
|
This might become obsolete with PR #16 and move to use requests package. |
|
This can be probably already closed since this code is no longer present (due to direct call to json() via requests) |
|
This code is no longer applicable - closing. |
json.load), assumes binary