Cherwell client for python3 applications
Install with:
pip install cherwell
Or, if you're using a development version cloned from this repository:
python path-to-where-you-cloned-cherwell/setup.py install
First, initialize a cherwell client instance
from cherwell.client import CherwellClient
cherwell_client = CherwellClient('<YOUR_CHERWELL_SERVER_ADDRESS>')
And then, request an authentication token to use in the other requests
token = cherwell_client.authenticate(
gt=<YOUR_GRANT_TYPE>,
cid=<YOUR_CLIENT_ID>,
user=<YOUT_USERNAME>,
pwd=<YOUR_PASSWORD>
)
With a token, you can for example create a business object.
Before, Given the cherwell API format, let's create a valid business object
from cherwell.models import BusinessObject, BusinessObjectFields
data = BusinessObject('FakeBusObjectId')
data.fields = [
BusinessObjectFields(
fieldId='FakeFieldid',
name='FakeFieldName',
value='FakeFieldValue',
dirty=True,
),
BusinessObjectFields(
fieldId='FakeFieldid2',
name='FakeFieldName2',
value='FakeFieldValue2',
dirty=True,
),
]
Now, just perform
bo = cherwell_client.save_business_object(token=<YOUR_TOKEN>, data=data)
For create/save your busines object
python -m unittest tests.test_client
This client was made to meet a specific need of my daily life. Obviously this is very simple and does not include 100% of what the cherwell API offers.
Pull requests are welcome, as long as they follow the standards adopted and contemplate unit tests