Commit a1b8ea04 authored by Aaron Hill's avatar Aaron Hill
Browse files

Don't manually decompress GZIP data

Requests handles this automatically for us
parent 828144f8
......@@ -191,15 +191,7 @@ def bind_api(**config):
raise TweepError(error_msg, resp)
# Parse the response payload
body = resp.text
if resp.headers.get('Content-Encoding', '') == 'gzip':
try:
zipper = gzip.GzipFile(fileobj=StringIO(body))
body = zipper.read()
except Exception as e:
raise TweepError('Failed to decompress data: %s' % e)
result = self.parser.parse(self, body)
result = self.parser.parse(self, resp.text)
# Store result into cache if one is available.
if self.use_cache and self.api.cache and self.method == 'GET' and result:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment