catch condition where you don't hear back

master
lza_menace 3 years ago
parent dc4a2c0f81
commit e0b2b0095c

@ -34,8 +34,11 @@ class Cache(object):
dns = f'{codename}.node.{config.DO_DOMAIN}'
url = f'https://{dns}/tor/'
r = r_get(url, timeout=6)
data = r.text.strip()
self.store_data(key_name, 86400, data)
if r.text:
data = r.text.strip()
self.store_data(key_name, 86400, data)
else:
data = ''
return data
except:
return {'error': 'true'}

Loading…
Cancel
Save