|
@@ -7,6 +7,7 @@ import time
|
7
|
7
|
import json
|
8
|
8
|
import os
|
9
|
9
|
import re
|
|
10
|
+import socket
|
10
|
11
|
import sys
|
11
|
12
|
import time
|
12
|
13
|
import urllib
|
|
@@ -191,10 +192,14 @@ def supervise(since):
|
191
|
192
|
**{'path': get_path}
|
192
|
193
|
}
|
193
|
194
|
|
194
|
|
- get_resp = requests.get(
|
195
|
|
- url=build_url(get_url),
|
196
|
|
- verify=False
|
197
|
|
- )
|
|
195
|
+ try:
|
|
196
|
+ get_resp = requests.get(
|
|
197
|
+ url=build_url(get_url),
|
|
198
|
+ verify=False
|
|
199
|
+ )
|
|
200
|
+ except socket.gaierror as exc:
|
|
201
|
+ logger.error('Socket error : %s', exc)
|
|
202
|
+ sys.exit(-1)
|
198
|
203
|
|
199
|
204
|
control_data = get_resp.json()
|
200
|
205
|
if Heatpump(mac_address).control(control_data):
|