The WoobBase class

class WoobBase(modules_path: Optional[str] = None, storage: Optional[IStorage] = None, scheduler: Optional[IScheduler] = None)[source]

Bases: object

Woob class to load modules from a specific path, without deal with woob remote repositories.

It provides methods to build backends or call methods on all loaded backends.

You should use this class when you want to build an application using Woob as a library, without using the standard modules nor the automatic module download and update machanism. When using WoobBase, you have to explicitely provide module paths and deal yourself with backend configuration.


Call this method when you stop using Woob, to properly unload all correctly.

build_modules_loader() ModulesLoader[source]

Build the module loader for the current application.

This can be overridden by children to avoid overriding an already existing modules loader.

Return type


build_backend(module_name: str, params: Optional[dict] = None, storage: Optional[IStorage] = None, name: Optional[str] = None, nofail: bool = False, logger: Logger = None) Module[source]

Create a backend.

It does not load it into the Woob object, so you are responsible for deinitialization and calls.

  • module_name – name of module

  • params (dict) – parameters to give to backend

  • storage ( – storage to use

  • name (str) – name of backend

  • nofail (bool) – if true, this call can’t fail

  • logger (logging.Logger) – logger to use

Return type

exception LoadError(backend_name: str, exception: Exception)[source]

Bases: Exception

Raised when a backend is unabled to load.

  • backend_name – name of backend we can’t load

  • exception – exception object

load_backend(module_name: str, name: str, params: Optional[dict] = None, storage: IStorage = None, nofail: bool = False)[source]

Load a backend.

  • module_name (str:) – name of module to load

  • name (str) – name of instance

  • params (dict) – parameters to give to backend

  • storage ( – storage to use

  • nofail (bool) – if true, this call can’t fail

Return type

unload_backends(names: Optional[List[str]] = None) Dict[str, Module][source]

Unload backends.


names (list) – if specified, only unload that backends

get_backend(name: str, **kwargs) Module[source]

Get a backend from its name.

  • name (str) – name of backend to get

  • default (whatever you want) – if specified, get this value when the backend is not found


KeyError if not found.

count_backends() int[source]

Get number of loaded backends.

iter_backends(caps: Optional[List[Capability]] = None, module: Optional[str] = None)[source]

Iter on each backends.

Note: each backend is locked when it is returned.

Return type


do(function: Union[Callable, str], *args, **kwargs) BackendsCall[source]

Do calls on loaded backends with specified arguments, in separated threads.

This function has two modes:

  • If function is a string, it calls the method with this name on each backends with the specified arguments;

  • If function is a callable, it calls it in a separated thread with the locked backend instance at first arguments, and *args and **kwargs.

  • function (str) – backend’s method name, or a callable object

  • backends (list[str]) – list of backends to iterate on

  • caps (list[woob.capabilities.base.Capability]) – iterate on backends which implement this caps

Return type

A woob.core.bcall.BackendsCall object (iterable)

schedule(interval: int, function: Callable, *args) Optional[int][source]

Schedule an event.

  • interval (int) – delay before calling the function

  • function (callabale) – function to call

  • args – arguments to give to function


an event identificator

repeat(interval: int, function: Callable, *args) Optional[int][source]

Repeat a call to a function

  • interval (int) – interval between two calls

  • function (callable) – function to call

  • args – arguments to give to function


an event identificator

cancel(ev: int) bool[source]

Cancel an event


ev – the event identificator

want_stop() None[source]

Plan to stop the scheduler.


Run the scheduler loop

load_or_install_module(module_name: str) Module[source]

Load a backend, but can’t install it