Managed connection error during current IP retrieval

This commit is contained in:
Daniele Verducci 2023-04-25 09:20:18 +02:00
parent 52d195be09
commit 8b5b2c9bda

View File

@ -121,7 +121,11 @@ class Main:
def getCurrentIp(self): def getCurrentIp(self):
'''Obtains current IP from checkip.dyndns.org''' '''Obtains current IP from checkip.dyndns.org'''
try:
response = requests.get(CHECKIP_REQUEST_ADDR) response = requests.get(CHECKIP_REQUEST_ADDR)
except Exception as e:
self._log.error('Unable to obtain new IP addr: connection error: {}'.format(e))
return
match = re.search(CHECKIP_RESPONSE_PARSER, response.text, re.MULTILINE) match = re.search(CHECKIP_RESPONSE_PARSER, response.text, re.MULTILINE)
if not match: if not match: