home · contact · privacy
In URL parser, add http.client.BadStatusLine handler.
[plomlombot-irc.git] / plomlombot.py
index 5fcd517a95f563cfba7a00146d1e6359780a0472..c1c23089ba01450ef5f2cd686f000580e44398cb 100755 (executable)
@@ -7,6 +7,7 @@ import select
 import time
 import re
 import urllib.request
 import time
 import re
 import urllib.request
+import http.client
 import html
 
 # Defaults, may be overwritten by command line arguments.
 import html
 
 # Defaults, may be overwritten by command line arguments.
@@ -105,7 +106,7 @@ def lineparser_loop(io, nickname):
                 try:
                     webpage = urllib.request.urlopen(url, timeout=15)
                 except (urllib.error.HTTPError, urllib.error.URLError,
                 try:
                     webpage = urllib.request.urlopen(url, timeout=15)
                 except (urllib.error.HTTPError, urllib.error.URLError,
-                        UnicodeError) as error:
+                        UnicodeError, http.client.BadStatusLine) 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()