GithubHelp home page GithubHelp logo

gzip decompression about requests HOT 8 CLOSED

psf avatar psf commented on June 20, 2024
gzip decompression

from requests.

Comments (8)

aantn avatar aantn commented on June 20, 2024

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

from requests.

kennethreitz avatar kennethreitz commented on June 20, 2024

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'

from requests.

aantn avatar aantn commented on June 20, 2024

Thanks, you are correct.

from requests.

aantn avatar aantn commented on June 20, 2024

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

from requests.

kennethreitz avatar kennethreitz commented on June 20, 2024

Ah, hmm...

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

from requests.

aantn avatar aantn commented on June 20, 2024

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.

from requests.

kennethreitz avatar kennethreitz commented on June 20, 2024

Moving to #19

from requests.

kennethreitz avatar kennethreitz commented on June 20, 2024

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

from requests.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.