This robot is an example of how you can wrap an existing Python script into a robot that is runnable on Robocorp's Control Room. It shows the following concepts:
- How to configure a Python robot to accept email triggers from Control Room.
- How to extract a file from a work item (an Excel file).
- Using secrets from the Control Room Vault.
- How to send an output file via IMAP/SMPT mail services.
- Logging to the
artifactDir
as defined inrobot.yaml
.
- Reproduce examples above using Robot Framework calling Python as keyword(s).
- Allow robot to utilize behavior-driven-style .feature files as if they were robot files.
This repository can be used as a template for building similar automations when you already have an existing Python script that you wish to automate via the Control Room. You will need to modify implementation of each keyword in task.py
considering the use case of your Python script, but the basic concepts should be followed to facilitate scheduling and reporting of activity from the Python script.
You must determine what dependencies your script has and add them to the conda.yaml
. You should use specific versions to lock the dependencies because floating versions or undefined versions result in environment rebuild every run with our tooling.
While you should not have to perform extensive modifications, you must consider if your script is interacting with the underlying system and modify it to change that behavior. Robots generally interact only within their own directory tree through the use of output
and temp
directories.
Work items offer a method to get new input files to your script if that is necessary. You can modify your script to directly utilize work items following the example in task.py
here or you can extract the file and provide it to the underlying script.
You can use the Robocorp Control Room vault to manage credentials securely, and again, you can modify your script to directly use the vault or you can set environment variables or pass them in via function calls as you prefer.