diff --git a/contrib/boobot.py b/contrib/boobot.py index 4ee0f302..c1c6c790 100755 --- a/contrib/boobot.py +++ b/contrib/boobot.py @@ -173,7 +173,7 @@ class MyThread(Thread): def check_twitter(self): nb_tweets = 10 - for _, backend in self.weboob.load_backends(modules=['twitter']).iteritems(): + for backend in self.weboob.iter_backends(module='twitter'): for thread in list(itertools.islice(backend.iter_resources(None, ['search', 'weboob']), 0, nb_tweets)): diff --git a/weboob/core/ouiboube.py b/weboob/core/ouiboube.py index aac0d836..19ab7dcc 100644 --- a/weboob/core/ouiboube.py +++ b/weboob/core/ouiboube.py @@ -184,7 +184,7 @@ class WebNip(object): """ return len(self.backend_instances) - def iter_backends(self, caps=None): + def iter_backends(self, caps=None, module=None): """ Iter on each backends. @@ -192,10 +192,13 @@ class WebNip(object): :param caps: optional list of capabilities to select backends :type caps: tuple[:class:`weboob.capabilities.base.Capability`] + :param module: optional name of module + :type module: :class:`basestring` :rtype: iter[:class:`weboob.tools.backend.Module`] """ for _, backend in sorted(self.backend_instances.iteritems()): - if caps is None or backend.has_caps(caps): + if caps is None or backend.has_caps(caps) and \ + module is None or backend.NAME == module: with backend: yield backend