From 7768e8791b7d64d70bec5f471861c31828210deb Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Thu, 26 Jan 2017 22:01:38 +0200 Subject: [PATCH] Silently ignore errors if IGD is not accessible --- pupy/network/lib/igd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pupy/network/lib/igd.py b/pupy/network/lib/igd.py index d16bc0de..bd9f2c6d 100644 --- a/pupy/network/lib/igd.py +++ b/pupy/network/lib/igd.py @@ -242,7 +242,11 @@ class IGDClient: if not descURL: return - descXMLs = urllib2.urlopen(descURL).read() + try: + descXMLs = urllib2.urlopen(descURL, None, self.timeout).read() + except: + return + self.pr = urlparse(descURL) baseURL = self.pr.scheme + "://" + self.pr.netloc dom = fromstring(descXMLs)