The OT-BASE Python SDK is a Python front-end to the REST API in OT-BASE Asset Center, and to JSON files using the Portable Inventory Data format. It contains high-level methods that make processing asset data much easier than dealing with raw JSON data on your own.
The Python SDK is mostly intended for two use cases:
- manipulating asset data in OT-BASE Asset Center using scripting (rather than manual operations)
- executing basic data queries and analytics.
The Python SDK comes in source code as a flat file (ot_base.py) that you need to store in your working directory. It uses the following dependencies:
If you haven't installed the json, pandas, and requests modules already, you need to do so using pip.
Importing the Python SDK in your program code
Once that the above mentioned dependencies are met, you can import the Python SDK using the following statement:
from ot_base import OtDeviceSet, OtDevice
if you want to use both classes. Thereafter, you can instantiate and process objects of class OtDeviceSet, which represent subsets of your asset inventory, and objects of class OtDevice which present single devices.
In order to execute your code you also need a data source. This can either be a Portable Inventory Data file that you have previously exported from OT-BASE Asset Center, or an online connection to Asset Center using the REST API. Once that either requirement is fulfilled, you can start pulling, manipulating, and pushing asset data.