Here is the situation:
I get gzipped xml documents from Amazon S3
import boto from boto.s3.connection import S3Connection from boto.s3.key i
I had to do the same thing and this is how I did it:
import gzip f = StringIO.StringIO() k.get_file(f) f.seek(0) #This is crucial gzf = gzip.GzipFile(fileobj=f) file_content = gzf.read()