Handle case of empty 'Link' header from server

pull/67/head
Chronister 2017-08-11 17:40:04 -07:00
rodzic d1b7d89eaa
commit 4efebe2c9f
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -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':