From 8b5b2c9bda0fa9422f5f3b127ca516f33b554642 Mon Sep 17 00:00:00 2001 From: Daniele Verducci Date: Tue, 25 Apr 2023 09:20:18 +0200 Subject: [PATCH] Managed connection error during current IP retrieval --- mddclient/mddclient.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mddclient/mddclient.py b/mddclient/mddclient.py index 2be0e1e..22c8aa1 100755 --- a/mddclient/mddclient.py +++ b/mddclient/mddclient.py @@ -121,7 +121,11 @@ class Main: def getCurrentIp(self): '''Obtains current IP from checkip.dyndns.org''' - response = requests.get(CHECKIP_REQUEST_ADDR) + try: + 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) if not match: