Skip to content

Commit

Permalink
Fix crash on URLs with no 'rel' attribute (Fixes #79)
Browse files Browse the repository at this point in the history
  • Loading branch information
halcy committed Sep 5, 2017
1 parent 87ee1df commit 1c93e35
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mastodon/Mastodon.py
Expand Up @@ -960,6 +960,9 @@ def __api_request(self, method, endpoint, params = {}, files = {}, do_ratelimiti
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 not 'rel' in url:
continue

if url['rel'] == 'next':
# Be paranoid and extract max_id specifically
next_url = url['url']
Expand Down

0 comments on commit 1c93e35

Please sign in to comment.