exception woob.browser.switch.SiteSwitch(name)

Bases: Exception

Exception to raise to switch to another Browser.


name (str) – key of the SwitchingBrowser.BROWSERS dict to indicate the new browser class to use

class woob.browser.switch.SwitchingBrowser(*args, **kwargs)

Bases: object

Proxy browser to use multiple (exclusive) browsers.

When some sites have mutually exclusive sub-sites, it may be better to split a browser in multiple browsers. If it’s not possible to know in advance what browser should be used, the SwitchingBrowser can help.

Multiple browsers should be configured in the BROWSERS attribute as a dict. When first used, SwitchingBrowser will instanciate the browser class with the ‘main’ key and proxy all method calls to it. If that browser raises SiteSwitch exception, another browser (associated to the exception key parameter) will be instanciated and will be used to retry the call which failed.


dict association keys to browser classes.

It should contain a ‘main’ key for the first browser class to use.


Pass the values stored in __states__


Whether to pass the requests.session.Session between browsers.