Python decompress gzip data in memory without file
I have gzipped data from HTTP reply. I have following code: def gzipDecode(self, content): import StringIO import gzip outFilePath = 'test' compressedFile = StringIO.StringIO(content) decompressedFile = gzip.GzipFile(fileobj=compressedFile) with open(outFilePath, 'w') as outfile: outfile.write(decompressedFile.read()) data = '' with open(outFilePath, 'r') as myfile: data=myfile.read().replace('\n', '') return data which decompress input gzipped content and return string (http reply is gzipped json). - It works. But I need it without creating test file - all in memory. I modified it to: def