Обработка timeout для urllib.

В одном из запусков timeout не определился как UrlError
develop 3.4.1.1
Mike Khiretskiy 9 jaren geleden
bovenliggende 8de913d54a
commit 9933d9cdc4

@ -297,11 +297,14 @@ class VariableClUpdateBinhostData(ReadonlyTableVariable):
self.Get('cl_update_binhost_timestamp_path'))
try:
t = time.time()
data = urllib2.urlopen(timestamp_file, timeout=timeout).read().strip()
data = urllib2.urlopen(timestamp_file,
timeout=timeout).read().strip()
if data.isdigit() and t - int(data) < 5 * DAY:
return data, int((time.time() - t)*1000)
except urllib2.URLError as e:
pass
except BaseException as e:
pass
return "", -1
def get(self, hr=False):

Laden…
Annuleren
Opslaan