X-Git-Url: https://jfr.im/git/z_archive/twitter.git/blobdiff_plain/19e3d13d97b7e366b8b30fe5ac2cf22677e69656..17b9ff10207340026b876eb623660f2c79bfe85d:/twitter/api.py diff --git a/twitter/api.py b/twitter/api.py index 25d55c6..bb1ca6c 100644 --- a/twitter/api.py +++ b/twitter/api.py @@ -65,9 +65,14 @@ class TwitterHTTPError(TwitterError): if self.e.headers.get('Content-Encoding') == 'gzip': buf = StringIO(data) f = gzip.GzipFile(fileobj=buf) - self.response_data = f.read() + data = f.read() + if len(data) == 0: + data = {} + elif "json" == self.format: + data = json.loads(data.decode('utf8')) else: - self.response_data = data + data = data.decode('utf8') + self.response_data = data super(TwitterHTTPError, self).__init__(str(self)) def __str__(self): @@ -399,11 +404,7 @@ class Twitter(TwitterCall): text="I think yer swell!") # Get the members of tamtar's list "Things That Are Rad" - t._("tamtar")._("things-that-are-rad").members() - - # Note how the magic `_` method can be used to insert data - # into the middle of a call. You can also use replacement: - t.user.list.members(user="tamtar", list="things-that-are-rad") + t.lists.members(owner_screen_name="tamtar", slug="things-that-are-rad") # An *optional* `_timeout` parameter can also be used for API # calls which take much more time than normal or twitter stops