Manage socket timeout error
This commit is contained in:
parent
ff87b1877a
commit
b96ecd0605
@ -15,6 +15,7 @@ import time
|
|||||||
# import urllib library
|
# import urllib library
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.error
|
import urllib.error
|
||||||
|
import socket
|
||||||
|
|
||||||
# import json
|
# import json
|
||||||
import json
|
import json
|
||||||
@ -104,6 +105,14 @@ def main(meteobridge_url, meteobridge_user, meteobridge_passwd, max_host, max_po
|
|||||||
except urllib.error.URLError as e:
|
except urllib.error.URLError as e:
|
||||||
if debug_urllib_print:
|
if debug_urllib_print:
|
||||||
print('URL Error Reason: ', e.reason)
|
print('URL Error Reason: ', e.reason)
|
||||||
|
|
||||||
|
if isinstance(e.reason, socket.timeout):
|
||||||
|
logging.error("Socket timed out from : " + meteobridge_url + " - URL Error Reason: " + str(e.reason))
|
||||||
|
error_counter += 1
|
||||||
|
send_osc_message(oscSender, osc_error_addr, OSC_meteobridge_url_error)
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
else:
|
||||||
logging.error("Get sensor datas from : " + meteobridge_url + " - URL Error Reason: " + str(e.reason))
|
logging.error("Get sensor datas from : " + meteobridge_url + " - URL Error Reason: " + str(e.reason))
|
||||||
error_counter += 1
|
error_counter += 1
|
||||||
send_osc_message(oscSender, osc_error_addr, OSC_meteobridge_url_error)
|
send_osc_message(oscSender, osc_error_addr, OSC_meteobridge_url_error)
|
||||||
|
Loading…
Reference in New Issue
Block a user