From 13bf8db116ca5e331ff741f3cf67da7d7ce4b964 Mon Sep 17 00:00:00 2001 From: Swee Date: Sat, 12 Oct 2024 15:50:22 -0700 Subject: [PATCH] Update sweebot.py --- sweebot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sweebot.py b/sweebot.py index 733ddc5..c2ebe54 100644 --- a/sweebot.py +++ b/sweebot.py @@ -12,6 +12,10 @@ import threading from pathlib import Path from requests import get from bs4 import BeautifulSoup +headers = { + 'User-Agent': 'SweeBot IRC ' + __version__, + 'From': 'bot@swee.codes' +} class config: def __init__(self): self.conn = sqlite3.connect(environ["SBconfig"]) @@ -573,14 +577,14 @@ while True: try: for i in command: if i[:8] == "https://": - e = get(i) + e = get(i, headers=headers) if e.ok: soup = BeautifulSoup(e.text, 'html.parser') multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel) else: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) elif i[:7] == "http://": - e = get(i) + e = get(i, headers=headers) if e.ok: soup = BeautifulSoup(e.text, 'html.parser') multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel)