Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Use proper API in http_to_file #521

Closed
dgilman opened this issue Oct 29, 2017 · 1 comment
Closed

Use proper API in http_to_file #521

dgilman opened this issue Oct 29, 2017 · 1 comment

Comments

@dgilman
Copy link

dgilman commented Oct 29, 2017

http_to_file() in twitter_utils.py gets data out of the Response object as Response.raw.data which is a property from the underlying urllib3 library that doesn't do the proper decoding. If the server sent gzipped data it won't be decompressed. Response.content should be used instead as it handles the decoding for you (see https://github.com/requests/requests/blob/master/requests/models.py#L724 , decode_content=True)

@jeremylow
Copy link
Collaborator

Fixed in 2bf461f

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants