adds useragent to zaagmans request
This commit is contained in:
+5
-1
@@ -16,6 +16,7 @@ class Shitpost(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.hdConImpatientEvents = []
|
||||
self.userAgent = 'Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0'
|
||||
try:
|
||||
with open('black.txt') as zwart:
|
||||
self.zwarte_lijst = [line.rstrip('\n') for line in zwart]
|
||||
@@ -811,7 +812,10 @@ class Shitpost(commands.Cog):
|
||||
|
||||
def get_zaagmans(self):
|
||||
zaagman_url = "http://iszaagmansallangsgeweest.nl/"
|
||||
zreq = requests.get(zaagman_url)
|
||||
headers = {
|
||||
'User-Agent': self.userAgent,
|
||||
}
|
||||
zreq = requests.get(zaagman_url, headers=headers)
|
||||
if zreq:
|
||||
return zreq.text.partition("<h1>")[2].partition("</h1>")[0]
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user