A Python Package to deploy tasks on Automation Anywhere 360
Project description
Automation Anywhere Python API Integration
About
This Python module is used to talk to Automation Anywhere 360 and start Tasks on selected machines.
Automation Anywhere does have a basic check if the task was "asked to be deployed" successfully, albeit very simple, it's still better then nothing.
Install
There are some minimum dependencies:
pip install requests>=2.21
After installing them, you can proceed with the installation:
pip install automation_anywhere
Usage
As is, for the version 360, you can use the package to deploy a task as such:
from automation_anywhere.executor import Executor
base_url = 'https://your-automation-controlroom-url/'
username = 'your-username'
password = 'your-password'
aa_executor = Executor(base_url, username, password)
devices, _, error = aa_executor.list_devices(hostname='host', run_as_user='user_to_run_as')
if error is not None:
# handle the error
pass
automations, _, error = aa_executor.list_automations(name='Test')
if error is not None:
# handle the error
pass
# Get the run as user id to execute, we'll just get the first one
users_ids = int(devices[0]['defaultUsers'][0]['id'])
# Get the automation id to execute, we'll just get the first one
automation_id = int(automations[0]['id'])
# Deploy
success, error, deployment_id, deployment_name = aa_executor.deploy(automation_id, [users_ids])
if success:
# handle the error
pass
else:
print(f'Deployed on id {deployment_id} with name {deployment_name}')
aa_executor.logout()
The errors will come 100% from the APIs of the Control Room.
What about task status?
I found an endpoint where you can get the job execution status, by filtering it via deployment id or deployment name. Here's a sample usage:
from automation_anywhere.executor import Executor
base_url = 'https://your-automation-controlroom-url/'
username = 'your-username'
password = 'your-password'
deploy_id = '377b04a5-fa8b-4e4a-8db5-8d769fd6639b'
deploy_name = 'Test.2023.05.19.17.28.51.test@test.com'
aa_executor = Executor(base_url, username, password)
success, error, data = aa_executor.status(deploy_id=deploy_id)
And the dictionary output:
[{'automationId': '',
'automationName': 'Test.2023.05.19.17.28.51.test@test.com',
'automationPriority': 'PRIORITY_MEDIUM',
'botLabel': '',
'callbackInfo': '',
'canManage': True,
'command': 'logToFile',
'createdBy': '41',
'createdOn': '2023-05-19T17:28:51.949121Z',
'currentBotName': 'Test',
'currentLine': 1,
'deploymentId': '377b04a5-fa8b-4e4a-8db5-8d769fd6639b',
'deviceId': '10',
'deviceName': 'utils',
'endDateTime': '2023-05-19T17:29:23.438893600Z',
'fileId': '459',
'fileName': 'Test',
'filePath': '',
'id': '5a3823af-3495-4692-9a08-0da80e70f046_06a59328ad01bfaa',
'message': '',
'modifiedBy': '41',
'modifiedOn': '2023-05-19T17:29:25.115503Z',
'progress': 100,
'queueId': '',
'queueName': '',
'runElevated': False,
'startDateTime': '2023-05-19T17:29:21.602952600Z',
'status': 'COMPLETED',
'tenantUuid': '0a662aeb-8728-11a9-8187-bed41445010e',
'totalLines': 1,
'type': 'RUN_NOW',
'userId': '41',
'userName': 'test@test.com',
'usingRdp': False}]
Basically it's a list with all executions found with the filter, and all their status.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file automation_anywhere-2.1.7.tar.gz
.
File metadata
- Download URL: automation_anywhere-2.1.7.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bc2c357ff5db7f6ad37ad24a7218d68145b4dfd1311855648598f16ceb4f2cf |
|
MD5 | cdfba7145dcf8dc64a2c28eb5b117387 |
|
BLAKE2b-256 | 9602f44580d58a9884c1b70fe3b4c11579b7ab09b467c112911edc176d2a87a8 |
File details
Details for the file automation_anywhere-2.1.7-py3-none-any.whl
.
File metadata
- Download URL: automation_anywhere-2.1.7-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5cfdf21e2b3bb64542bcfad885073176d4d31aa59e73f691dd85c3e7fb1866b |
|
MD5 | a8314ef3279dfccf86eb6c3ecd01dc2f |
|
BLAKE2b-256 | 2a36d5051d45d8de7d810be7b95ca5207403b63391c7219b4b7f97c82c4bc57f |