This is a cleaner approach that requires less configuration
in other applications.
This also easily allows us to have another color.
Many checks were made on being exactly at the DEBUG level, they were
fixed to also check on being below DEBUG (i.e. DEBUG_FILTERS).
weboob.tools.browser -> weboob.deprecated.browser
weboob.tools.parsers -> weboob.deprecated.browser.parsers
weboob.tools.mech -> weboob.deprecated.mech
weboob.browser2 -> weboob.browser
weboob.core.exceptions -> weboob.exceptions
Also, the new tree for browser2 is:
weboob.browser: import weboob.browser.browsers.* and weboob.browser.url.*
weboob.browser.browsers: all browsers (including PagesBrowser and LoginBrowser)
weboob.browser.url: the URL class
weboob.browser.profiles: all Profile classes
weboob.browser.sessions: WeboobSession and FuturesSession
weboob.browser.cookies: that's a cookies thing
weboob.browser.pages: all Page and derivated classes, and Form class
weboob.browser.exceptions: specific browser exceptions
weboob.browser.elements: AbstractElement classes, and 'method' decorator
weboob.browser.filters.*: all filters
They bring nothing of value (we never use import * anyway) and introduce
a maintenance burden.
The __all__ that I left might not be very useful either but at least
they are not a pain to maintain; they are also used by pyflakes in some
cases.
The import process of requests is very expensive: it imports all urllib,
and a lot of stuff. It is a problem on slow hardware, for applications
not running browser2 (example: weboob-config update).
This patch has two mains parts:
* introduces load_browser to load a browser only if needed (a lot of repository
processing does not need a browser)
* Do not import exceptions of requests, but use Weboob internals one
Before: 6455 open/190 modules imported
After: 3997 open/112 modules