From a1b8ea049b5ed2ab13b8f9e705d327cc4bfea2ee Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Wed, 14 May 2014 18:28:30 -0400 Subject: [PATCH] Don't manually decompress GZIP data Requests handles this automatically for us --- tweepy/binder.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tweepy/binder.py b/tweepy/binder.py index 7a9cef9..c9afb1a 100644 --- a/tweepy/binder.py +++ b/tweepy/binder.py @@ -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: -- 2.25.1