From 3f5fc178338c70d9c6548a58b553c363bb05aa14 Mon Sep 17 00:00:00 2001 From: Mark Hoekveen Date: Thu, 10 Apr 2025 11:03:18 +0200 Subject: [PATCH] adds useragent to zaagmans request --- Shitpost.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Shitpost.py b/Shitpost.py index bbe533c..267ff51 100644 --- a/Shitpost.py +++ b/Shitpost.py @@ -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("

")[2].partition("

")[0] else: