readurl() can take same arguments than openurl()
This commit is contained in:
parent
9142569594
commit
0b7ef16103
1 changed files with 6 additions and 3 deletions
|
|
@ -253,11 +253,13 @@ class BaseBrowser(mechanize.Browser):
|
||||||
self.home()
|
self.home()
|
||||||
return mechanize.Browser.open(self, *args, **kwargs)
|
return mechanize.Browser.open(self, *args, **kwargs)
|
||||||
|
|
||||||
def readurl(self, url, if_fail=None):
|
def readurl(self, url, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Download URL data specifying what to do on failure (nothing by default).
|
Download URL data specifying what to do on failure (nothing by default).
|
||||||
"""
|
"""
|
||||||
result = self.openurl(url, if_fail=if_fail)
|
if not 'if_fail' in kwargs:
|
||||||
|
kwargs['if_fail'] = None
|
||||||
|
result = self.openurl(url, *args, **kwargs)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
if self.SAVE_RESPONSES:
|
if self.SAVE_RESPONSES:
|
||||||
|
|
@ -384,7 +386,8 @@ class BaseBrowser(mechanize.Browser):
|
||||||
if self._cookie:
|
if self._cookie:
|
||||||
self._cookie.save()
|
self._cookie.save()
|
||||||
|
|
||||||
def buildurl(self, base, *args, **kwargs):
|
@staticmethod
|
||||||
|
def buildurl(base, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Build an URL and escape arguments.
|
Build an URL and escape arguments.
|
||||||
You can give a serie of tuples in *args (and the order is keept), or
|
You can give a serie of tuples in *args (and the order is keept), or
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue