Skip to main content

Python Functions for Alteryx Workflow Management

This document explains two Python functions designed to manage Alteryx workflows through their API:

1. generate_oauth_token(certificate_location, access_token_url, username, password, print_access_token):

This function acquires an OAuth 2.0 access token necessary for interacting with the Alteryx API.

Parameters:

  1. certificate_location (str): Path to the certificate file used for verifying the API endpoint.
  2. access_token_url (str): URL for obtaining the access token.
  3. username (str): Username for authentication.
  4. password (str): Password for authentication.
  5. print_access_token (bool): Set to True to print the obtained access token.

Return Value:

str: The access token on successful retrieval, otherwise None.

2. trigger_alteryx_workflow(certificate_location, access_token_url, url, username, password, print_access_token)

This function triggers an Alteryx workflow using the obtained access token.

Parameters:

  1. certificate_location (str): Path to the certificate file used for verifying the API endpoint.
  2. access_token_url (str): URL for obtaining the access token.
  3. url (str): URL of the Alteryx workflow endpoint to trigger.
  4. username (str): Username for authentication.
  5. password (str): Password for authentication.
  6. print_access_token (bool): Set to True to print the obtained access token.

Return Value:

int: HTTP status code of the trigger request. 200 indicates successful workflow triggering.

Example Usage:

# Replace with your specific values
certificate_location = "path/to/certificate.pem"
access_token_url = "https://your-alteryx-server/oauth2/token"
url = "https://your-alteryx-server/api/workflows/123/run"
username = "your_username"
password = "your_password"
print_access_token = True

# Obtain access token
access_token = generate_oauth_token(certificate_location, access_token_url, username, password, print_access_token)

# Trigger workflow
status_code = trigger_alteryx_workflow(certificate_location, access_token_url, url, username, password, print_access_token)

if status_code == 200:
  print("Workflow triggered successfully!")
else:
  print(f"Error triggering workflow: {status_code}")

Additional Notes:

  1. Ensure you have the requests and json libraries installed (pip install requests json).
  2. Replace the placeholder values with your actual Alteryx configuration details.
  3. This example demonstrates basic usage. Error handling and more robust implementation might be required in production environments.

I hope this README clarifies the usage of these functions for managing Alteryx workflows through Python. Feel free to ask if you have any further questions.

Metadata

Release files for AlteryxConnector 0.3

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

Built distribution (wheel)

Table of built distributions (wheels) for AlteryxConnector 0.3
File Interpreter ABI Platform
AlteryxConnector-0.3-py3-none-any.whl Python 3 none any Details

Release files / AlteryxConnector-0.3-py3-none-any.whl

Download URL AlteryxConnector-0.3-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1453a2ea1b04a16865ae07b05b2644504111d8e86c39e2d2fa895429c2e62e4b
BLAKE2b-256 checksum
How to use checksums
545a54064d61f9a207a8b8e1b97c021403f6d140334b2abb7f1a154cdfd17901
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file

0.2

1 release file

0.1

1 release file

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