forked from swee/MeowNex
add more error handling
This commit is contained in:
parent
b3d945bc42
commit
cae57f1c14
1 changed files with 4 additions and 2 deletions
|
@ -586,16 +586,18 @@ while True:
|
||||||
e = get(i, headers=headers, timeout=10)
|
e = get(i, headers=headers, timeout=10)
|
||||||
if e.ok:
|
if e.ok:
|
||||||
soup = BeautifulSoup(e.text, 'html.parser')
|
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:
|
else:
|
||||||
multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel)
|
multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel)
|
||||||
except rex.SSLError as ex:
|
except rex.SSLError as ex:
|
||||||
multiline("(" + nick + ") [SSL Error: " + str(ex.__cause__) + "]", channel)
|
multiline("(" + nick + ") [SSL Error: " + str(ex.__cause__) + "]", channel)
|
||||||
|
except:
|
||||||
|
multiline("(" + nick + ") [Request error:" + str(ex.__cause__) + "]", channel)
|
||||||
elif i[:7] == "http://":
|
elif i[:7] == "http://":
|
||||||
e = get(i, headers=headers, timeout=10)
|
e = get(i, headers=headers, timeout=10)
|
||||||
if e.ok:
|
if e.ok:
|
||||||
soup = BeautifulSoup(e.text, 'html.parser')
|
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:
|
else:
|
||||||
multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel)
|
multiline("(" + nick + ") [HTTP " + str(e.status_code) + "]", channel)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue