mirror of
https://github.com/ihabunek/toot
synced 2024-12-23 07:27:12 +01:00
Set the user agent string to all requests
Fixes issue with accessing instances using Cloudfare DDOS protection. issue #106
This commit is contained in:
parent
07a01df941
commit
840b2fd476
@ -1,9 +1,14 @@
|
||||
from requests import Request, Session
|
||||
from toot import __version__
|
||||
from toot.exceptions import NotFoundError, ApiError
|
||||
from toot.logging import log_request, log_response
|
||||
|
||||
|
||||
def send_request(request, allow_redirects=True):
|
||||
# Set a user agent string
|
||||
# Required for accesing instances using Cloudfront DDOS protection.
|
||||
request.headers["User-Agent"] = "toot/{}".format(__version__)
|
||||
|
||||
log_request(request)
|
||||
|
||||
with Session() as session:
|
||||
|
Loading…
Reference in New Issue
Block a user