weboob.tools.browser.browser

exception weboob.tools.browser.browser.BrowserIncorrectPassword
exception weboob.tools.browser.browser.BrowserForbidden
exception weboob.tools.browser.browser.BrowserBanned
exception weboob.tools.browser.browser.BrowserUnavailable
exception weboob.tools.browser.browser.BrowserRetry
exception weboob.tools.browser.browser.BrowserPasswordExpired
exception weboob.tools.browser.browser.BrowserHTTPNotFound
exception weboob.tools.browser.browser.BrowserHTTPError
exception weboob.tools.browser.browser.BrokenPageError
class weboob.tools.browser.browser.BasePage(browser, document, url='', groups=None, group_dict=None, logger=None)

Base page

on_loaded()

Called when the page is loaded.

class weboob.tools.browser.browser.StandardBrowser(firefox_cookies=None, parser=None, history=<weboob.tools.browser.browser.NoHistory object at 0x5319e10>, proxy=None, logger=None, factory=None, responses_dirname=None)

Standard Browser.

Parameters:
  • firefox_cookies (str) – path to cookies sqlite file
  • parser (weboob.tools.parsers.iparser.IParser) – parser to use on HTML files
  • history (object) – history manager; default value is an object which does not keep history
  • proxy (str) – proxy URL to use
  • factory (object) – mechanize factory. None to use Mechanize’s default
static buildurl(base, *args, **kwargs)

Build an URL and escape arguments.

You can give a serie of tuples in args (and the order is keept), or a dict in kwargs (but the order is lost).

Example:

>>> StandardBrowser.buildurl('/blah.php', ('a', '&'), ('b', '='))
'/blah.php?a=%26&b=%3D'
>>> StandardBrowser.buildurl('/blah.php', a='&', b='=')
'/blah.php?b=%3D&a=%26'
get_document(result, parser=None, encoding=None)

Get a parsed document from a stream.

Parameters:result (stream) – HTML page stream
get_exception(e)
location(*args, **kwargs)

Go on an URL and get the related document.

lowsslcheck(domain, hsh)
openurl(*args, **kwargs)
readurl(url, *args, **kwargs)

Download URL data specifying what to do on failure (nothing by default).

save_response(result, warning=False)

Save a stream to a temporary file, and log its name. The stream is rewinded after saving.

set_field(args, label, field=None, value=None, is_list=False)

Set a value to a form field.

Parameters:
  • args (dict) – arguments where to look for value
  • label (str) – label in args
  • field (str) – field name. If None, use label instead
  • value (str) – value to give on field
  • is_list (bool) – the field is a list
str(s)
class weboob.tools.browser.browser.BaseBrowser(username=None, password=None, firefox_cookies=None, parser=None, history=<weboob.tools.browser.browser.NoHistory object at 0x5319810>, proxy=None, logger=None, factory=None, get_home=True, responses_dirname=None)

Base browser class to navigate on a website.

Parameters:
  • username (str) – username on website
  • password (str) – password on website. If it is None, Browser will not try to login
  • firefox_cookies (str) – path to cookies sqlite file
  • parser (weboob.tools.parsers.iparser.IParser) – parser to use on HTML files
  • history (object) – history manager; default value is an object which does not keep history
  • proxy (dictionnary) – proxy URL to use
  • logger (logging.Logger) – logger to use for logging
  • factory (object) – mechanize factory. None to use Mechanize’s default
  • get_home – try to get the homepage.
  • responses_dirname (str) – directory to store responses
absurl(rel)

Get an absolute URL from a relative one.

Follow a link on the page.

home()

Go to the home page.

is_logged()

Return True if we are logged on website. When Browser tries to access to a page, if this method returns False, it calls login().

It is never called if the password attribute is None.

is_on_page(pageCls)

Check the current page.

Parameters:pageCls (BasePage) – class of the page to check
Return type:bool
location(*args, **kwargs)
login()

Login to the website.

This function is called when is_logged() returns False and the password attribute is not None.

submit(*args, **kwargs)

Submit the selected form.

Previous topic

weboob.tools.browser

Next topic

weboob.tools.browser.decorators