How to get the handle of the current plugin?
![Dexter](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar5.png)
Dexter
Registered Posts: 2 ✭✭
I'm developing a plugin and I'd like to get the handle of the current plugin to get its name and settings. Similar to client.get_default_project() to get the current project.
Also, is there a way to know which scenario is triggering the plugin?
Is there any way to achieve this?
Tagged:
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,876 Neuron
Not sure what you mean by "current plugin". This code will get you all plugins and their usage:
client = dataiku.api_client() plugins_list = client.list_plugins() for plugin in plugins_list:
plugin_id = plugin['id']
plugin_author = plugin['meta']['author']
plugin_license = plugin['meta']['licenseInfo']
plugin_version = plugin['version']
plugin_handle = client.get_plugin(plugin_id)
plugin_settings = plugin_handle.get_settings().get_raw()
plugin_name = plugin['meta']['label']
plugin_code_env = plugin_settings.get('codeEnvName')
plugin_usages = plugin_handle.list_usages(project_key=None).get_raw() print(f'{plugin_id} - {plugin_name} - {plugin_code_env}')