From 079184855de3c451e8fcabdc3dd0b6907540cce6 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Fri, 30 Sep 2016 16:52:32 -0400 Subject: [PATCH] Implement a modules listing function --- cozyweboob.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cozyweboob.py b/cozyweboob.py index bbdb98f..078b21c 100755 --- a/cozyweboob.py +++ b/cozyweboob.py @@ -56,6 +56,25 @@ class WeboobProxy(object): """ Weboob().update(progress=DummyProgress()) + @staticmethod + def list_modules(capability=None): + """ + List all available modules and their configuration options. + + Args: + capability: Restrict the modules list to a given capability. + Returns: A dict mapping module names to supported capabilities and + available configuration options. + """ + available_modules = {} + moduleInfos = Weboob().repositories.get_all_modules_info(capability) + for module in moduleInfos: + available_modules[module] = { + "infos": dict(moduleInfos[module].dump()), + "config": None # TODO: Get config options from module + } + return available_modules + def __init__(self, modulename, parameters): """ Create a Weboob handle and try to load the modules.