Skip to content

Marvin Actions

Marvin Actions help you to interact with Marvin RPA functions.

Actions

marvin.execute

Add a new process to Marvin execution queue

Parameters:

script - name of the automation script to be executed.

vars - variables to be setted on script start.

robotKey - robotKey of the robot to execute the script. If the execution is at the same robot, keep it as None

robotSecret - robotSecret of the robot to execute the script. If the execution is at the same robot, keep it as None

Returns:

executionId - ID of the execution added to robots queue.

Usage Example
script.mvn
marvin.execute("another-process", {'email': '[email protected]', 'name': 'John'})
prompt.alert('Execution ID: ' + $executionId)

marvin.import_module

Imports Python modules that are not natively included with Marvin. Does the same as the import module and from package import module in Python.

Parameters:

import_name - name of the module to be imported. Here will be putted the part of the import of Pythons syntax.

from_name - used when the Python import contains from. Here will be putted the from part of Pythons syntax.

Returns:

<import_name> - return the requested module, with the same name as the given import_name.

Exceções:

ModuleNotInstalled - when the requested module was not installed previously, or the module is not present on Marvin. Check marvin.install_module action for further informations.

Usage Example - Import
script.mvn
marvin.import_module("pandas")
prompt.alert('Version: ' + ($pandas).__version__)
Usage Example - From Import
script.mvn
result = marvin.import_module('BeautifulSoup', 'bs4')

BeautifulSoup = $BeautifulSoup
soup = BeautifulSoup("<html>data</html>")
prompt.alert(soup.html.string)

marvin.install_module

Install modules that are not natively included with Marvin. This is a analog function to pip install <module> on Python.

Parameters:

module_name - name of the module to be installed for your process.

Returns:

This action has no return

Usage Example - From Import
script.mvn
marvin.install_module('beautifulsoup4')
result = marvin.import_module('BeautifulSoup', 'bs4')

BeautifulSoup = $BeautifulSoup
BeautifulSoup("<html>data</html>")
assert soup.html.string == 'data'

Important: sometimes the module name used on Python import is the same name as used for module instalation. If some error occurs, check if your informations are correct.