CW RPA Library
The `cw-rpa` package is a Python library providing reusable functions and common utilities specifically designed for developing Robotic Process Automation (RPA) bots. It offers modules for handling user inputs, logging, and interacting with web services. The current version is 1.2.2, released on October 12, 2025, and appears to have a regular release cadence based on the PyPI history.
Warnings
- gotcha RPA bots, including those built with `cw-rpa`, can be brittle and prone to breaking when target application user interfaces (UIs) change. Traditional RPA often relies on screen scraping or specific element locators, which can become invalid with UI updates. This requires frequent maintenance and adaptation of bot scripts.
- gotcha When using the `HttpClient` module, ensure proper handling of authentication tokens and validation of request payloads. Mistakes in managing tokens or providing incorrect payload structures can lead to failed API calls and security vulnerabilities.
- breaking While not specifically documented for `cw-rpa`, other related RPA frameworks (like `rpaframework`) have experienced breaking changes where general keywords for 'Set Asset' and 'Get Asset' were replaced by more specific ones (e.g., `Set Text Asset`, `Get Text Asset`). Developers should be aware that similar shifts in API design might occur in the broader RPA ecosystem, potentially affecting how assets or work item data are handled.
Install
-
pip install cw-rpa
Imports
- Input
from cw_rpa import Input
- Logger
from cw_rpa import Logger
- HttpClient
from cw_rpa import HttpClient
Quickstart
from cw_rpa import Input, Logger, HttpClient
import os
# Initialize modules
input_handler = Input()
logger = Logger()
http_client = HttpClient()
# Example: Get an input value (simulating environment variable or form data)
username = os.environ.get('RPA_USERNAME', 'default_user')
logger.info(f"Retrieved username: {username}")
# Example: Send an HTTP GET request (replace with a real endpoint)
try:
# Using a placeholder URL for demonstration
test_url = "https://jsonplaceholder.typicode.com/posts/1"
response = http_client.third_party_integration("example_integration").get(url=test_url)
logger.info(f"HTTP GET Response Status: {response.status_code}")
logger.info(f"HTTP GET Response Body: {response.json()}")
except Exception as e:
logger.error(f"Error during HTTP request: {e}")
# Example: Log an error message
logger.error("This is an example error log.")
# Example: Log an exception (simulated)
try:
1 / 0
except ZeroDivisionError as e:
logger.exception(f"Caught an exception: {e}")