From 3da97532fe4ea892fcc75b7cd4dbe9b418e97156 Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Fri, 10 Mar 2023 10:11:15 -0500 Subject: [PATCH] Changed user agent --- .scripts/refreshtoots.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.scripts/refreshtoots.py b/.scripts/refreshtoots.py index f6c9a8b..129fcdb 100755 --- a/.scripts/refreshtoots.py +++ b/.scripts/refreshtoots.py @@ -40,8 +40,11 @@ def retrieve_toots_from_server(): response: Optional[HTTPResponse] = None try: - response = request.urlopen(url) - except Exception: + req = request.Request(url) + req.add_header('User-Agent', 'Python3-Urllib/3') + response = request.urlopen(req) + except Exception as e: + print(e) print("Unable to grab toots from Mastodon.") if response is None: