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

gzip decompression #18

Closed
aantn opened this issue Apr 11, 2011 · 8 comments
Closed

gzip decompression #18

aantn opened this issue Apr 11, 2011 · 8 comments

Comments

@aantn
Copy link

aantn commented Apr 11, 2011

Reproducible example: https://gist.github.com/913423

@aantn
Copy link
Author

aantn commented Apr 11, 2011

I don't have time right now to fork requests and implement this, but here is how httplib2 handles decompression:

http://www.google.com/codesearch/p?hl=en#7p4WlYhzLQw/trunk/httplib2/__init__.py&q=zlib%20package:http://httplib2%5C.googlecode%5C.com&l=347

@aantn aantn closed this as completed Apr 11, 2011
@kennethreitz
Copy link
Contributor

Gzip'd data is supported and seamlessly decompressed by the underlying urllib2 library.

Its possible the server isn't sending the gzipped data over:

r.headers['Accept-encoding'] = 'gzip'

@aantn
Copy link
Author

aantn commented Apr 11, 2011

Thanks, you are correct.

@aantn
Copy link
Author

aantn commented Apr 11, 2011

Actually, content-encoding is set to gzip and accept-encoding is unset. Afaik, the two headers have independent meanings, so urllib2 should decompress the response.

References:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11 and http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3

@aantn aantn reopened this Apr 11, 2011
@kennethreitz
Copy link
Contributor

Ah, hmm...

Well if I can make it function better than urllib2 I'm all for it.

@aantn
Copy link
Author

aantn commented Apr 11, 2011

Tonight I'll file a bug in urllib2. Let me see if I can fix this...

Edit: Sorry, I keep closing this by accident. I'm not used to the way GitHub orders the buttons.

@aantn aantn closed this as completed Apr 11, 2011
@aantn aantn reopened this Apr 11, 2011
@kennethreitz
Copy link
Contributor

Moving to #19

@kennethreitz
Copy link
Contributor

Update: v0.3.2 was just released which includes automatic gzip encoded content decompression.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 9, 2021
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