weboob.deprecated.browser.browser

exception weboob.deprecated.browser.browser.BrowserIncorrectPassword

Bases: exceptions.Exception

exception weboob.deprecated.browser.browser.BrowserForbidden

Bases: exceptions.Exception

exception weboob.deprecated.browser.browser.BrowserBanned

Bases: weboob.exceptions.BrowserIncorrectPassword

exception weboob.deprecated.browser.browser.BrowserUnavailable

Bases: exceptions.Exception

exception weboob.deprecated.browser.browser.BrowserRetry

Bases: exceptions.Exception

exception weboob.deprecated.browser.browser.BrowserPasswordExpired

Bases: weboob.exceptions.ActionNeeded

exception weboob.deprecated.browser.browser.BrowserHTTPNotFound

Bases: weboob.exceptions.BrowserUnavailable

exception weboob.deprecated.browser.browser.BrowserHTTPError

Bases: weboob.exceptions.BrowserUnavailable

exception weboob.deprecated.browser.browser.BrokenPageError

Bases: exceptions.Exception

class weboob.deprecated.browser.browser.Page(browser, document, url='', groups=None, group_dict=None, logger=None)

Bases: object

Base page

ENCODING = None
on_loaded()

Called when the page is loaded.

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

Bases: mechanize._mechanize.Browser

Standard Browser.

Parameters:
  • firefox_cookies (str) – path to cookies sqlite file
  • parser (weboob.deprecated.browser.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
DEBUG_HTTP = False
DEBUG_MECHANIZE = False
DEFAULT_TIMEOUT = 15
ENCODING = 'utf-8'
INSECURE = False
USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'
USER_AGENTS = {'microb': 'Mozilla/5.0 (X11; U; Linux armv7l; fr-FR; rv:1.9.2.3pre) Gecko/20100723 Firefox/3.5 Maemo Browser 1.7.4.8 RX-51 N900', 'desktop_firefox': 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0', 'android': 'Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17', 'wget': 'Wget/1.11.4'}
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'
default_features = ['_redirect', '_cookies', '_equiv', '_basicauth', '_digestauth', '_proxy', '_proxy_basicauth', '_proxy_digestauth', '_referer']
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.

logger = None
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.deprecated.browser.browser.Browser(username=None, password=None, firefox_cookies=None, parser=None, history=<weboob.deprecated.browser.browser.NoHistory object>, proxy=None, logger=None, factory=None, get_home=True, responses_dirname=None)

Bases: weboob.deprecated.browser.browser.StandardBrowser

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.deprecated.browser.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
CERTHASH = None
DOMAIN = None
PAGES = {}
PROTOCOL = 'http'
absurl(rel)

Get an absolute URL from a relative one.

Follow a link on the page.

get_page(result)
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 (Page) – 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.

class weboob.deprecated.browser.browser.StateBrowser(*args, **kwargs)

Bases: weboob.deprecated.browser.browser.Browser

This browser aims to store state (cookies, location and attributes).

dump_state()
load_state(state)