A rest api wrapper for the Cherwell Service management platform
Project description
Overview
Cherpy is an API wrapper library to provide an easy way use the Cherwell rest API. It can be used for new scripts or simply used via the command line.
This provides convenience for the following
- Create and update objects
- Search for objects
- Get schema information
- Delete objects
- Call a onestep
Installation:
To install Cherpy, use:
pip install cherpy
Library usage:
Create client credentials from config
from cherpy.auth import config_from_env
from cherpy.main import search_object
# create client using env variable which contains the config file path
client = config_from_env("cherwell_dev")
# search for any incident object name, limit to 10 (0 for all)
search_object(client, object_name="Incident", pageSize=10)
# search for any incident containing the text desktop and returning the fields IncidentID and ownedbyteam
search_object(client, object_name="Incident", fields=["IncidentID", "ownedbyteam"], search_string="desktop",
pageSize=10)
Windows Command Line Usage:
Cherpy CLI Usage Guide
Cherpy is a command-line tool for interacting with the Cherwell API. Here's how to use each command:
Common Options
All commands support these common options:
-e, --env
: Environment variable containing config path (default: "cherpy_config")--object-name
: Name of the Cherwell object
Commands
Search
Search for Cherwell objects.
# Basic search returning specific fields
csm search --env cherwell_dev --object-name Incident FirstName LastName Status
# Search with text filter and pagination
csm search --env cherwell_dev --object-name Incident -s "printer issue" -ps 100 -pg 1
# Search and save status and description for all incidents to a file
csm search --object-name Incident -o output.csv Status Description
Create
Create new Cherwell records.
# Create from input file
csm create --env cherwell_config --object-name Incident -input-path data.csv
# Create with file dialog
csm create --env cherwell_config --object-name Incident -ask-file
# Create with direct key-value pairs
csm create --env cherwell_config --object-name Incident Description="New Issue" Status="New"
Update
Update existing Cherwell records (requires RecId field in input data).
# Update from file
csm update --object-name Incident --input-path updates.csv
# Update using file dialog
csm update --object-name Incident -a
Delete
Delete Cherwell records in batches.
# Delete with default chunk size (300)
csm delete --object-name Incident
# Delete with custom chunk size
csm delete --object-name Incident --chunk-size 500
Get Schema
Retrieve schema information for Cherwell objects.
# Get schema and display in console
csm get-schema --object-name Incident
# Save schema to file
csm get-schema --object-name Incident -o schema.txt
OneStep Operations
Get OneStep
Get information about a OneStep automation.
# Get OneStep info
csm get-onestep --object-name Incident -on "ProcessIncident" -sc "Global"
Run OneStep
Execute a OneStep automation.
# Run OneStep
csm run-onestep --object-name Incident -on "ProcessIncident" -sc "Global"
Example Workflow
# 1. Check object schema
csm get-schema --object-name Incident -o incident_schema.txt
# 2. Search for existing incidents
csm search --object-name Incident -s "printer" Status Description Owner
# 3. Create new incidents
csm create --object-name Incident --input-path new_incidents.csv
# 4. Update incidents
csm update --object-name Incident --input-path incident_updates.csv
# 5. Run a OneStep process
csm run-onestep --object-name Incident -on "ProcessIncident"
Note: All commands will prompt for the environment variable and object name if not specified
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 cherpy-0.6.0.tar.gz
.
File metadata
- Download URL: cherpy-0.6.0.tar.gz
- Upload date:
- Size: 35.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc00b6a3f790af198344d253035bc3b860d49e1270ea52ade5d8856789835457 |
|
MD5 | 166edf2df653f15a4b4d45a730e75093 |
|
BLAKE2b-256 | 1cd72a9e7c06410dda18f805a0ef668e31efe999c8fa4438ea079c378a85deac |
File details
Details for the file cherpy-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: cherpy-0.6.0-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.11.9 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0b1c6c9f261d504b9d5ed08f1364681a946956484c3dd17ea77030085c34f37 |
|
MD5 | 12f9cb77c5f972303e024853318e0e0c |
|
BLAKE2b-256 | 84fe4aa6cb5b8a2d46d97c863a244c347feec8517f427490b8741426adabaa23 |