Skip to content

Commit

Permalink
Set the user agent string to all requests
Browse files Browse the repository at this point in the history
Fixes issue with accessing instances using Cloudfare DDOS protection.

issue #106
  • Loading branch information
ihabunek committed Aug 7, 2019
1 parent 07a01df commit 840b2fd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions toot/http.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 840b2fd

Please sign in to comment.