This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients rhettinger
Date 2012-06-17.01:34:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1339896879.03.0.627255791455.issue15087@psf.upfronthosting.co.za>
In-reply-to
Content
The API for the gzip module is convenient for reading gzipped file but is rather awkward for reading bytes downloaded from a socket:

  >>> import gzip, io
  >>> from urllib.request import urlopen, Request
  >>> u = urlopen(Request('http://www.nytimes.com', headers={'Accept-Encoding': 'gzip'}))
  >>> content = gzip.GzipFile(fileobj=io.BytesIO(u.read()), mode='rb').read()

It would be better if the last line could be written:

  >>> content = gzip.decompress_file(u)
History
Date User Action Args
2012-06-17 01:34:39rhettingersetrecipients: + rhettinger
2012-06-17 01:34:39rhettingersetmessageid: <1339896879.03.0.627255791455.issue15087@psf.upfronthosting.co.za>
2012-06-17 01:34:38rhettingerlinkissue15087 messages
2012-06-17 01:34:37rhettingercreate