Skip to content

Package distribution, install and use

xi-yang edited this page Aug 5, 2021 · 6 revisions
  1. Create account on pypi.org and obtain an API token.

  2. Add ~/.pypirc

[pypi]
  username = __token__
  password = pypi-AgEIcHlwaS5vcmcCJGMyYzViNjVjLT..... mZTE5OTAyMGM4MAACJXsicGVybWlzc2lvbnMiOiAidXNlciIsICJ2ZXJzaW9uIjogMX0AAAYg4JaBIHZk_XIu-R2k24ZTZ6jIfMU3TEJ2cu0EoPh5yAo
  1. Check setup.py and modify file paths as needed.

  2. Build and upload the distribution

python3 -m pip install --upgrade build
python3 -m build
python3 -m twine upload --repository pypi dist/*
  1. pip3 install sense-o-api

  2. Add / configure /etc/sense-o-auth.yaml

  3. 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()
  1. A utility sense_util.py has also been available for sense-o-api==1.3 and above.
Clone this wiki locally