Skip to main content

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

  1. 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.
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enos_subscribe-2.6.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

enos_subscribe-2.6.0-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file enos_subscribe-2.6.0.tar.gz.

File metadata

  • Download URL: enos_subscribe-2.6.0.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for enos_subscribe-2.6.0.tar.gz
Algorithm Hash digest
SHA256 088eebb8c36878cbff7ea7d2ce33fb6778fdf0cb5c0febed08acbee54149a3b0
MD5 46613b63cb8067b1634676c312658d7f
BLAKE2b-256 13ad88f6a38c023d25178393a9f2a2913e68d99c6a04efdc44e1f87439d461bb

See more details on using hashes here.

File details

Details for the file enos_subscribe-2.6.0-py3-none-any.whl.

File metadata

  • Download URL: enos_subscribe-2.6.0-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for enos_subscribe-2.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 127915df6d3bb2cf0e9a8303eb51438f56ce13900fb5df57f749285727c28d9b
MD5 fd6f471ef39a9bfd5e69f6b3c41359d7
BLAKE2b-256 60c97cc4668b8582c63cc57f13fd0ec4d1bf536d0ca458a0c79e2e11a19bb47a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page