timeout
This commit is contained in:
parent
d6f350e5a1
commit
224864bace
1 changed files with 2 additions and 2 deletions
|
@ -34,7 +34,7 @@ class Node(object):
|
||||||
_cert = None
|
_cert = None
|
||||||
online = False
|
online = False
|
||||||
download_speed = 0
|
download_speed = 0
|
||||||
TIMEOUT = 3
|
TIMEOUT = 5
|
||||||
|
|
||||||
def __init__(self, nodes, user):
|
def __init__(self, nodes, user):
|
||||||
self._nodes = nodes
|
self._nodes = nodes
|
||||||
|
@ -248,7 +248,7 @@ class Node(object):
|
||||||
content = r.content
|
content = r.content
|
||||||
'''
|
'''
|
||||||
self._opener.addheaders = zip(headers.keys(), headers.values())
|
self._opener.addheaders = zip(headers.keys(), headers.values())
|
||||||
r = self._opener.open(url, timeout=self.TIMEOUT)
|
r = self._opener.open(url, timeout=self.TIMEOUT*2)
|
||||||
if r.getcode() == 200:
|
if r.getcode() == 200:
|
||||||
if r.headers.get('content-encoding', None) == 'gzip':
|
if r.headers.get('content-encoding', None) == 'gzip':
|
||||||
content = gzip.GzipFile(fileobj=r).read()
|
content = gzip.GzipFile(fileobj=r).read()
|
||||||
|
|
Loading…
Reference in a new issue