From 7f47fe95c5a786fb6538e24499b60294337b4b8c Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 18 Dec 2018 19:49:29 +0100 Subject: [PATCH] Fix problem due to invalid headers from t.co --- tootbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tootbot.py b/tootbot.py index c35aa41..83b4897 100755 --- a/tootbot.py +++ b/tootbot.py @@ -87,7 +87,7 @@ for t in reversed(d.entries[0:5]): m = re.search(r"http[^ \xa0]*", c) if m != None: l = m.group(0) - r = requests.get(l, allow_redirects=False) + r = requests.get(l, allow_redirects=False, headers={'Accept-Encoding': 'identity'}) if r.status_code in {301,302}: c = c.replace(l,r.headers.get('Location'))