Package: enos-subscribe
Using EnOS Data Subscription SDK for PythonTable of ContentsInstallationPrerequisitesInstalling from PipBuilding From SourceFeature ListSample CodesRelated InformationRelease NotesEnOS 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.InstallationPrerequisitesThe 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 pipThe 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-subscribeBuilding From SourceObtain the source code of Data Subscription SDK for Python.From GitHub:git clone https://github.com/EnvisionIot/enos-subscription-service-sdk-python.gitFrom EnOS SDK Center. ClickSDK Centerfrom the left navigation of EnOS Console, and obtain the SDK source code by clicking the GitHub icon in theObtaincolumn.From the directory where the source code is stored, run the following command:python setup.py installThe EnOS Data Subscription SDK for Python has the following dependency modules:sixgoogle.protobufwebsocket_clientFeature ListEnOS 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 dataConsuming subscribed alert dataConsuming subscribed offline asset dataConsuming subscribed event dataSample CodesCode Sample for Consuming Subscribed Real-time Datafrom 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 Datafrom 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 Datafrom 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 Datafrom 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 Datafrom 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 InformationTo learn more about the Data Subscription feature of EnOS Enterprise Data Platform, seeData Subscription Overview.Release Notes2020/03/03 (2.4.1): Initial release2020/04/08 (2.5.0): Added the feature of event data subscription2020/11/24 (2.6.0): Added the feature of advanced alert subscription