From 1c93e350f74626b67bb50503d6ee6fcb9656bc2b Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Tue, 5 Sep 2017 16:39:17 +0200 Subject: [PATCH] Fix crash on URLs with no 'rel' attribute (Fixes #79) --- mastodon/Mastodon.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 6513c33..d5c6225 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -960,6 +960,9 @@ class Mastodon: 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']