If you are talking about a simple .gz file, no, urllib2 will not decode it, you will get an immutable .gz file as output.
If you are talking about automatic HTTP layer compression using Content-Encoding: gzip or deflate , then this should be deliberately requested by the client using the Accept-Encoding header.
urllib2 does not set this header, so the response it returns will not be compressed. You can safely retrieve a resource without worrying about compression (although since compression is not supported, the request may take longer).
bobince Oct. 16 '10 at 1:28 2010-10-16 01:28
source share