weboob.tools.application.console

class weboob.tools.application.console.ConsoleApplication(option_parser=None)

Bases: weboob.tools.application.base.Application

Base application class for CLI applications.

BOLD = '\x1b[1m'
CAPS = None
NC = '\x1b[0m'
acquire_input(content=None, editor_params=None)
add_backend(module_name, backend_name, params=None, edit=False, ask_register=True)
ask(question, default=None, masked=None, regexp=None, choices=None, tiny=None)

Ask a question to user.

@param question text displayed (str) @param default optional default value (str) @param masked if True, do not show typed text (bool) @param regexp text must match this regexp (str) @param choices choices to do (list) @param tiny ask for the (small) value of the choice (bool) @return entered text by user (str)

bcall_error_handler(backend, error, backtrace)

Handler for an exception inside the CallErrors exception.

This method can be overridden to support more exceptions types.

bcall_errors_handler(errors, debugmsg='Use --debug option to print backtraces', ignore=())

Handler for the CallErrors exception.

check_loaded_backends(default_config=None)
do(function, *args, **kwargs)
edit_backend(name, params=None)
install_module(name)
is_module_loadable(info)
load_backends(*args, **kwargs)
load_default_backends()

By default loads all backends.

Applications can overload this method to restrict backends loaded.

login_cb(backend_name, value)
parse_id(_id, unique_backend=False)
print(txt)
prompt_create_backends(default_config=None)
register_backend(name, ask_add=True)
classmethod run(args=None)

This static method can be called to run the application.

It creates the application object, handles options, setups logging, calls the main() method, and catches common exceptions.

You can’t do anything after this call, as it always finishes with a call to sys.exit().

For example:

>>> from weboob.application.myapplication import MyApplication
>>> MyApplication.run()
unload_backends(*args, **kwargs)
exception weboob.tools.application.console.BackendNotGiven(id, backends)

Bases: exceptions.Exception