home
·
contact
·
privacy
projects
/
plomlombot-irc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handle UnicodeDecodeError.
[plomlombot-irc.git]
/
plomlombot.py
diff --git
a/plomlombot.py
b/plomlombot.py
index 6031d50b3167eb62dfbe16865e1c8278efa44e41..7d0f5355a1f70eb1cc946249d1d5e76154b33b49 100755
(executable)
--- a/
plomlombot.py
+++ b/
plomlombot.py
@@
-109,7
+109,8
@@
def lineparser_loop(io, nickname):
try:
webpage = urllib.request.urlopen(request, timeout=15)
except (urllib.error.HTTPError, urllib.error.URLError,
try:
webpage = urllib.request.urlopen(request, timeout=15)
except (urllib.error.HTTPError, urllib.error.URLError,
- UnicodeError, http.client.BadStatusLine) as error:
+ UnicodeError, http.client.BadStatusLine,
+ UnicodeDecodeError) as error:
print("TROUBLE FOLLOWING URL: " + str(error))
continue
charset = webpage.info().get_content_charset()
print("TROUBLE FOLLOWING URL: " + str(error))
continue
charset = webpage.info().get_content_charset()
@@
-124,7
+125,7
@@
def lineparser_loop(io, nickname):
content = webpage.read().decode(charset)
title = str(content).split('<title>')[1].split('</title>')[0]
title = html.unescape(title)
content = webpage.read().decode(charset)
title = str(content).split('<title>')[1].split('</title>')[0]
title = html.unescape(title)
- io.send_line("
PRIVMSG
" + target + " :page title for url: "
+ io.send_line("
NOTICE
" + target + " :page title for url: "
+ title)
sender = ""
+ title)
sender = ""