home · contact · privacy
Handle URLError.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 17 Jan 2016 22:29:11 +0000 (23:29 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 17 Jan 2016 22:29:11 +0000 (23:29 +0100)
plomlombot.py

index 9a8a85329ffafb3c34642fa75def9b55f57422ac..dc6577a554841a0a218f20c5ae936c142a54d12f 100755 (executable)
@@ -100,7 +100,8 @@ def lineparser_loop(io, nickname):
                 url = matches[i]
                 try:
                     webpage = urllib.request.urlopen(url, timeout=15)
                 url = matches[i]
                 try:
                     webpage = urllib.request.urlopen(url, timeout=15)
-                except urllib.error.HTTPError as error:
+                except (urllib.error.HTTPError, urllib.error.URLError) \
+                    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()