mirror of
https://github.com/Brandon-Rozek/website-toots.git
synced 2024-11-22 00:06:30 -05:00
Changed user agent
This commit is contained in:
parent
4f75d8a45a
commit
3da97532fe
1 changed files with 5 additions and 2 deletions
|
@ -40,8 +40,11 @@ def retrieve_toots_from_server():
|
||||||
response: Optional[HTTPResponse] = None
|
response: Optional[HTTPResponse] = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = request.urlopen(url)
|
req = request.Request(url)
|
||||||
except Exception:
|
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.")
|
print("Unable to grab toots from Mastodon.")
|
||||||
|
|
||||||
if response is None:
|
if response is None:
|
||||||
|
|
Loading…
Reference in a new issue