Ejemplo n.º 1
0
 def get_plugin_representation_from_store_by_url(url, timeout=30):
     """
     Get a plugin app representation from the ChRIS store given the url of the plugin.
     """
     store_url = settings.CHRIS_STORE_URL
     store_client = StoreClient(store_url, None, None, timeout)
     result = store_client.get_data_from_collection(store_client.get(url))
     if result['data']:
         plg = result['data'][0]
     else:
         raise NameError("Could not find plugin with url '%s'" % url)
     plg['parameters'] = PluginManager.get_plugin_parameters_from_store(
         plg['id'], timeout)
     return plg
Ejemplo n.º 2
0
    def get_plugin_representation_from_store_by_url(url, timeout=30):
        """
        Get a plugin app representation from the ChRIS store given the url of the plugin.
        """
        store_url = settings.CHRIS_STORE_URL
        store_client = StoreClient(store_url, None, None, timeout)
        res = store_client.get(url)
        result = store_client.get_data_from_collection(res)

        if not result['data']:
            raise NameError(f"Could not find plugin with url '{url}'")

        plg = result['data'][0]
        parameters_url = res.items[0].links.get(rel='parameters').href
        plg['parameters'] = PluginManager.get_plugin_parameters_from_url(
            parameters_url, timeout)
        return plg
Ejemplo n.º 3
0
 def get_plugin_parameters_from_url(parameters_url, timeout=30):
     """
     Get a plugin's parameters representation from a ChRIS store by URL.
     """
     store_url = settings.CHRIS_STORE_URL
     store_client = StoreClient(store_url, None, None, timeout)
     parameters = []
     offset = 0
     limit = 50
     while True:
         res = store_client.get(parameters_url, {
             'limit': limit,
             'offset': offset
         })
         result = store_client.get_data_from_collection(res)
         parameters.extend(result['data'])
         offset += limit
         if not result['hasNextPage']: break
     return parameters