-
Notifications
You must be signed in to change notification settings - Fork 4
Package distribution, install and use
xi-yang edited this page Aug 5, 2021
·
6 revisions
-
Create account on pypi.org and obtain an API token.
-
Add ~/.pypirc
[pypi]
username = __token__
password = pypi-AgEIcHlwaS5vcmcCJGMyYzViNjVjLT..... mZTE5OTAyMGM4MAACJXsicGVybWlzc2lvbnMiOiAidXNlciIsICJ2ZXJzaW9uIjogMX0AAAYg4JaBIHZk_XIu-R2k24ZTZ6jIfMU3TEJ2cu0EoPh5yAo
-
Check setup.py and modify file paths as needed.
-
Build and upload the distribution
python3 -m pip install --upgrade build
python3 -m build
python3 -m twine upload --repository pypi dist/*
-
pip3 install sense-o-api
-
Add / configure
/etc/sense-o-auth.yaml
-
Example use of the package to provision and deprovision a SENSE service
>>> import json
>>> from sense.client.workflow_combined_api import WorkflowCombinedApi
>>> client = WorkflowCombinedApi()
>>> client.instance_new()
'd3767610-ee93-49eb-b17d-3d2edb6a47e1'
>>> intent_file = open("test/requests/request-1.json")
>>> intent = json.load(intent_file)
>>> intent_file.close()
>>> response = client.instance_create(json.dumps(intent))
>>> print(response)
{"service_uuid":"d3767610-ee93-49eb-b17d-3d2edb6a47e1","intent_uuid":"c3ce7a95-e380-422d-9eab-4fb4e1203e66","queries":[]}
>>> self.client.instance_delete()
- A utility
sense_util.py
has also been available for sense-o-api==1.3 and above.