Skip to main content

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.

Release files for automation-anywhere 2.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for automation-anywhere 2.1.7
File Size Uploaded
automation_anywhere-2.1.7.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for automation-anywhere 2.1.7
File Interpreter ABI Platform
automation_anywhere-2.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / automation_anywhere-2.1.7.tar.gz

Download URL automation_anywhere-2.1.7.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2bc2c357ff5db7f6ad37ad24a7218d68145b4dfd1311855648598f16ceb4f2cf
BLAKE2b-256 checksum
How to use checksums
9602f44580d58a9884c1b70fe3b4c11579b7ab09b467c112911edc176d2a87a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / automation_anywhere-2.1.7-py3-none-any.whl

Download URL automation_anywhere-2.1.7-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5cfdf21e2b3bb64542bcfad885073176d4d31aa59e73f691dd85c3e7fb1866b
BLAKE2b-256 checksum
How to use checksums
2a36d5051d45d8de7d810be7b95ca5207403b63391c7219b4b7f97c82c4bc57f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

2.1.7 This release

2 release files

2.1.6

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page