diff --git a/src/plugins/plugin_misc_ip.py b/src/plugins/plugin_misc_ip.py index a5fa712b..dbf7d518 100644 --- a/src/plugins/plugin_misc_ip.py +++ b/src/plugins/plugin_misc_ip.py @@ -23,6 +23,7 @@ from sat.core.log import getLogger log = getLogger(__name__) from sat.tools import xml_tools from twisted.web import client as webclient +from twisted.web import error as web_error from twisted.internet import defer from twisted.internet import reactor from twisted.internet import protocol @@ -51,6 +52,7 @@ PLUGIN_INFO = { "description": _("""This plugin help to discover our external IP address.""") } +# TODO: GET_IP_PAGE should be configurable in sat.conf GET_IP_PAGE = "http://www.goffi.org/sat_tools/get_ip.php" # This page must only return external IP of the requester GET_IP_LABEL = D_(u"Allow external get IP") GET_IP_CATEGORY = "General" @@ -289,6 +291,9 @@ class IPPlugin(object): except (internet_error.DNSLookupError, internet_error.TimeoutError): log.warning(u"Can't access Domain Name System") ip = None + except web_error.Error as e: + log.warning(u"Error while retrieving IP on {url}: {message}".format(url=GET_IP_PAGE, message=e)) + ip = None else: self._external_ip_cache = ip defer.returnValue(ip)