Enos subscribe client for python
Project description
Using EnOS Data Subscription SDK for Python
Table of Contents
EnOS Data Subscription Service improves the API calling efficiency of applications with active data push, which supports subscription to real-time asset data, offline asset data, asset alert data, and asset event data.
After configuring and starting data subscription jobs on the EnOS Management Console, you can use the Data Subscription SDK for Python to develop applications for consuming the subscribed data.
Installation
Prerequisites
The Data Subscription SDK for Python supports Python 2.7, Python 3.4, and newer versions.
You can install the SDK from pip, or build from source.
Installing from pip
The latest version of EnOS Data Subscription SDK for Python is available in the Python Package Index (PyPi) and can be installed using:
pip install enos-subscribe
Building From Source
-
Obtain the source code of Data Subscription SDK for Python.
- From GitHub:
git clone https://github.com/EnvisionIot/enos-subscription-service-sdk-python.git
- From EnOS SDK Center. Click SDK Center from the left navigation of EnOS Console, and obtain the SDK source code by clicking the GitHub icon in the Obtain column.
-
From the directory where the source code is stored, run the following command:
python setup.py install
The EnOS Data Subscription SDK for Python has the following dependency modules:
- six
- google.protobuf
- websocket_client
Feature List
EnOS Enterprise Data Platform supports subscribing to asset time series data and alert data and pushing the subscribed data to applications, thus improving the data query efficiency of applications.
The features supported by this SDK include:
- Consuming subscribed real-time asset data
- Consuming subscribed alert data
- Consuming subscribed offline asset data
- Consuming subscribed event data
Sample Codes
Code Sample for Consuming Subscribed Real-time Data
from enos_subscribe import DataClient
if __name__ == '__main__':
client = DataClient(host='sub-host', port='sub-port',
access_key='Your Access Key of this subscription',
access_secret='Your Access Secret of this subscription')
client.subscribe(sub_id='Your subscription Id')
for message in client:
print(message)
Code Sample for Consuming Subscribed Alert Data
from enos_subscribe import AlertClient
if __name__ == '__main__':
client = AlertClient(host='sub-host', port='sub-port',
access_key='Your Access Key of this subscription',
access_secret='Your Access Secret of this subscription')
client.subscribe(sub_id='Your subscription Id')
for message in client:
print(message)
Code Sample for Consuming Subscribed Advanced Alert Data
from enos_subscribe import AdvancedAlertClient
if __name__ == '__main__':
client = AdvancedAlertClient(host='sub-host', port='sub-port',
access_key='Your Access Key of this subscription',
access_secret='Your Access Secret of this subscription')
client.subscribe(sub_id='Your subscription Id')
for message in client:
print(message)
Code Sample for Consuming Subscribed Offline Data
from enos_subscribe import OfflineClient
if __name__ == '__main__':
client = OfflineClient(host='sub-host', port='sub-port',
access_key='Your Access Key of this subscription',
access_secret='Your Access Secret of this subscription')
client.subscribe(sub_id='Your subscription Id')
for message in client:
print(message)
Code Sample for Consuming Subscribed Event Data
from enos_subscribe import EventClient
if __name__ == '__main__':
client = EventClient(host='sub-host', port='sub-port',
access_key='Your Access Key of this subscription',
access_secret='Your Access Secret of this subscription')
client.subscribe(sub_id='Your subscription Id')
for message in client:
print(message)
Related Information
To learn more about the Data Subscription feature of EnOS Enterprise Data Platform, see Data Subscription Overview.
Release Notes
- 2020/03/03 (2.4.1): Initial release
- 2020/04/08 (2.5.0): Added the feature of event data subscription
- 2020/11/24 (2.6.0): Added the feature of advanced alert subscription
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
Hashes for enos_subscribe-2.6.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 127915df6d3bb2cf0e9a8303eb51438f56ce13900fb5df57f749285727c28d9b |
|
MD5 | fd6f471ef39a9bfd5e69f6b3c41359d7 |
|
BLAKE2b-256 | 60c97cc4668b8582c63cc57f13fd0ec4d1bf536d0ca458a0c79e2e11a19bb47a |