diff --git a/botcmd.py b/botcmd.py index 7730b37..5471582 100644 --- a/botcmd.py +++ b/botcmd.py @@ -138,7 +138,14 @@ def handle_message(*, prefix, message, nick, channel, irc): try: try: - with urllib.request.urlopen(url, timeout = 5) as response: + headers = { + 'User-Agent': 'Cockatric4 (like Lynx)', + 'Accept': '*/*', + 'Accept-Language': 'en,*;q=0.1', + 'Accept-Charset': 'utf-8', + } + request = urllib.request.Request(url, headers = headers) + with urllib.request.urlopen(request, timeout = 5) as response: if response.info().get_content_type() == 'text/html': # First 4KiB of a page should be enough for any # Turns out it's not, so download 64KiB