From cae57f1c143b41e5f1a56b55d3791bfdb1964e33 Mon Sep 17 00:00:00 2001 From: swee Date: Sun, 13 Oct 2024 23:35:53 -0700 Subject: [PATCH] add more error handling --- sweebot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sweebot.py b/sweebot.py index b9f18d6..336e2f0 100644 --- a/sweebot.py +++ b/sweebot.py @@ -586,16 +586,18 @@ while True: e = get(i, headers=headers, timeout=10) if e.ok: soup = BeautifulSoup(e.text, 'html.parser') - multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel) + multiline("(" + nick + ") " + soup.title.string if soup.title != None else "[No title provided]", channel) else: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) except rex.SSLError as ex: multiline("(" + nick + ") [SSL Error: " + str(ex.__cause__) + "]", channel) + except: + multiline("(" + nick + ") [Request error:" + str(ex.__cause__) + "]", channel) elif i[:7] == "http://": e = get(i, headers=headers, timeout=10) if e.ok: soup = BeautifulSoup(e.text, 'html.parser') - multiline("(" + nick + ") " + soup.title.string if soup.title.string != None else "[No title provided]", channel) + multiline("(" + nick + ") " + soup.title.string if soup.title != None else "[No title provided]", channel) else: multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel) except: