Handle case of empty 'Link' header from server
This commit is contained in:
pare
d1b7d89eaa
commit
4efebe2c9f
S'han modificat 1 arxius amb 1 adicions i 1 eliminacions
|
@ -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))
|
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
|
# 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('>,<', ',<'))
|
tmp_urls = requests.utils.parse_header_links(response_object.headers['Link'].rstrip('>').replace('>,<', ',<'))
|
||||||
for url in tmp_urls:
|
for url in tmp_urls:
|
||||||
if url['rel'] == 'next':
|
if url['rel'] == 'next':
|
||||||
|
|
Loading…
Referencia en una nova incidència