browser2: Add a default timeout
Because no timeout is pretty dangerous
This commit is contained in:
parent
a1b7232521
commit
72cbc5bd8b
1 changed files with 2 additions and 0 deletions
|
|
@ -96,6 +96,7 @@ class Wget(Profile):
|
||||||
|
|
||||||
class Browser(object):
|
class Browser(object):
|
||||||
PROFILE = Firefox()
|
PROFILE = Firefox()
|
||||||
|
TIMEOUT = 10.0
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
profile = self.PROFILE
|
profile = self.PROFILE
|
||||||
|
|
@ -200,6 +201,7 @@ class Browser(object):
|
||||||
data = kwargs.get('data')
|
data = kwargs.get('data')
|
||||||
if data is not None and len(data) == 0:
|
if data is not None and len(data) == 0:
|
||||||
kwargs.setdefault('headers', {}).setdefault('Content-Length', '0')
|
kwargs.setdefault('headers', {}).setdefault('Content-Length', '0')
|
||||||
|
kwargs.setdefault('timeout', self.TIMEOUT)
|
||||||
return self.session.request(*args, **kwargs)
|
return self.session.request(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue