new methods Weboob.do() and Weboob.do_caps() to do asynchronous calls
This commit is contained in:
parent
ad4fc17a89
commit
adb77fc586
1 changed files with 9 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
import os
|
import os
|
||||||
from logging import warning
|
from logging import warning
|
||||||
|
|
||||||
|
from weboob.bcall import BackendsCall
|
||||||
from weboob.modules import ModulesLoader, BackendsConfig
|
from weboob.modules import ModulesLoader, BackendsConfig
|
||||||
from weboob.scheduler import Scheduler
|
from weboob.scheduler import Scheduler
|
||||||
|
|
||||||
|
|
@ -94,6 +95,14 @@ class Weboob(object):
|
||||||
if caps is None or backend.has_caps(caps):
|
if caps is None or backend.has_caps(caps):
|
||||||
yield backend
|
yield backend
|
||||||
|
|
||||||
|
def do(self, function, *args, **kwargs):
|
||||||
|
backends = [b for b in self.iter_backends()]
|
||||||
|
return BackendsCall(backends, function, *args, **kwargs)
|
||||||
|
|
||||||
|
def do_caps(self, caps, function, *args, **kwargs):
|
||||||
|
backends = [b for b in self.iter_backends(caps)]
|
||||||
|
return BackendsCall(backends, function, *args, **kwargs)
|
||||||
|
|
||||||
def schedule(self, interval, function, *args):
|
def schedule(self, interval, function, *args):
|
||||||
return self.scheduler.schedule(interval, function, *args)
|
return self.scheduler.schedule(interval, function, *args)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue