aboutsummaryrefslogtreecommitdiff
path: root/src/utils/http.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/http.py')
-rw-r--r--src/utils/http.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/utils/http.py b/src/utils/http.py
index f31da62c..3cae97ea 100644
--- a/src/utils/http.py
+++ b/src/utils/http.py
@@ -1,9 +1,8 @@
import asyncio, codecs, ipaddress, re, signal, socket, traceback, typing
import urllib.error, urllib.parse, uuid
import json as _json
-import bs4, netifaces, requests
-import tornado.httpclient
-from src import utils
+import bs4, netifaces, requests, tornado.httpclient
+from src import IRCBot, utils
REGEX_URL = re.compile("https?://\S+", re.I)
@@ -29,8 +28,8 @@ def url_sanitise(url: str):
url = url[:-1]
return url
-DEFAULT_USERAGENT = ("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 "
- "(KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36")
+USERAGENT = "Mozilla/5.0 (compatible; BitBot/%s; +%s" % (
+ IRCBot.VERSION, IRCBot.URL)
RESPONSE_MAX = (1024*1024)*100
SOUP_CONTENT_TYPES = ["text/html", "text/xml", "application/xml"]
@@ -113,7 +112,7 @@ class Request(object):
if not "Accept-Language" in headers:
headers["Accept-Language"] = "en-GB"
if not "User-Agent" in headers:
- headers["User-Agent"] = self.useragent or DEFAULT_USERAGENT
+ headers["User-Agent"] = self.useragent or USERAGENT
if not "Content-Type" in headers and self.content_type:
headers["Content-Type"] = self.content_type
return headers