Changed user agent

This commit is contained in:
Brandon Rozek 2023-03-10 10:11:15 -05:00
parent 4f75d8a45a
commit 3da97532fe
No known key found for this signature in database
GPG key ID: 26E457DA82C9F480

View file

@ -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: