From 4efebe2c9f6550c8a0bf109bfc802743faaabbeb Mon Sep 17 00:00:00 2001 From: Chronister Date: Fri, 11 Aug 2017 17:40:04 -0700 Subject: Handle case of empty 'Link' header from server --- mastodon/Mastodon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 7203c8a..0ef62bf 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -957,7 +957,7 @@ class Mastodon: raise MastodonAPIError("Could not parse response as JSON, response code was %s, bad json content was '%s'" % (response_object.status_code, response_object.content)) # Parse link headers - if isinstance(response, list) and 'Link' in response_object.headers: + if isinstance(response, list) and 'Link' in response_object.headers and response_object.headers['Link'] != "": tmp_urls = requests.utils.parse_header_links(response_object.headers['Link'].rstrip('>').replace('>,<', ',<')) for url in tmp_urls: if url['rel'] == 'next': -- cgit v1.2.3