Put request url in an intermediate variable

This commit is contained in:
Alexandre Aubin 2017-08-09 16:12:35 +02:00
parent 31105b8c86
commit a5331063cc

View file

@ -183,15 +183,15 @@ def dyndns_update(dyn_host="dyndns.yunohost.org", domain=None, key=None,
try:
# Check if domain is registered
if requests.get('https://{0}/test/{1}'.format(
dyn_host, _domain), timeout=30).status_code == 200:
request_url = 'https://{0}/test/{1}'.format(dyn_host, _domain)
if requests.get(request_url, timeout=30).status_code == 200:
continue
except requests.ConnectionError:
raise MoulinetteError(errno.ENETUNREACH,
m18n.n('no_internet_connection'))
except requests.exceptions.Timeout:
logger.warning("Correction timed out on {}, skip it".format(
'https://{0}/test/{1}'.format(dyn_host, _domain)))
request_url))
domain = _domain
key = path
break