More updates and cleanups for new requests
This commit is contained in:
parent
5711158f80
commit
b07da18081
1 changed files with 3 additions and 9 deletions
|
|
@ -92,8 +92,6 @@ class Firefox(Profile):
|
||||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||||
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0',
|
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0',
|
||||||
'DNT': '1'}
|
'DNT': '1'}
|
||||||
# It also has "Connection: Keep-Alive", that should only be added this way:
|
|
||||||
#FIXME session.config['keep_alive'] = True
|
|
||||||
|
|
||||||
|
|
||||||
class Wget(Profile):
|
class Wget(Profile):
|
||||||
|
|
@ -111,7 +109,6 @@ class Wget(Profile):
|
||||||
session.headers.update({
|
session.headers.update({
|
||||||
'Accept': '*/*',
|
'Accept': '*/*',
|
||||||
'User-Agent': 'Wget/%s' % self.version})
|
'User-Agent': 'Wget/%s' % self.version})
|
||||||
#FIXME session.config['keep_alive'] = True
|
|
||||||
|
|
||||||
|
|
||||||
class BaseBrowser(object):
|
class BaseBrowser(object):
|
||||||
|
|
@ -138,12 +135,8 @@ class BaseBrowser(object):
|
||||||
|
|
||||||
if self.TIMEOUT:
|
if self.TIMEOUT:
|
||||||
session.timeout = self.TIMEOUT
|
session.timeout = self.TIMEOUT
|
||||||
# Raise exceptions on HTTP errors
|
## weboob only can provide proxy and HTTP auth options
|
||||||
#session.config['safe_mode'] = False
|
session.trust_env = False
|
||||||
#session.config['danger_mode'] = True
|
|
||||||
## weboob only can provide proxy and auth options
|
|
||||||
#session.config['trust_env'] = False
|
|
||||||
# TODO max_retries?
|
|
||||||
# TODO connect config['verbose'] to our logger
|
# TODO connect config['verbose'] to our logger
|
||||||
|
|
||||||
profile.setup_session(session)
|
profile.setup_session(session)
|
||||||
|
|
@ -225,6 +218,7 @@ class BaseBrowser(object):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
REFRESH_RE = re.compile("^(?P<sleep>[\d\.]+)(; url=[\"']?(?P<url>.*?)[\"']?)?$", re.IGNORECASE)
|
REFRESH_RE = re.compile("^(?P<sleep>[\d\.]+)(; url=[\"']?(?P<url>.*?)[\"']?)?$", re.IGNORECASE)
|
||||||
|
|
||||||
def handle_refresh(self, response):
|
def handle_refresh(self, response):
|
||||||
"""
|
"""
|
||||||
Called by _open, to handle Refresh HTTP header.
|
Called by _open, to handle Refresh HTTP header.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue