GithubHelp home page GithubHelp logo

digidotcom / python-devicecloud Goto Github PK

View Code? Open in Web Editor NEW
37.0 46.0 20.0 7.58 MB

Python client library for the Digi Device Cloud Web Services API

Home Page: http://www.digi.com/cloud/digi-device-cloud

License: Mozilla Public License 2.0

Python 99.34% Shell 0.56% Batchfile 0.10%

python-devicecloud's Introduction

Python Device Cloud Library

Build Status Coverage Status Latest Version License

Be sure to check out the full documentation. A Changelog is also available.

Overview

Python-devicecloud is a library providing simple, intuitive access to Digi Device Cloud(sm) for clients written in Python.

The library wraps Device Cloud's REST API and hides the details of forming HTTP requests in order to gain access to device information, file data, streams, and other features of Device Cloud. The API can be found here.

The primary target audience for this library is individuals interfacing with Device Cloud from the server side or developers writing tools to aid device development. For efficient connectivity from devices, we suggest that you first look at using the Device Cloud Connector. That being said, this library could also be used on devices if deemed suitable.

Example

The library provides access to a wide array of features, but here is a couple quick examples to give you a taste of what the API looks like.

from devicecloud import DeviceCloud

dc = DeviceCloud('user', 'pass')

# show the MAC address of all devices that are currently connected
#
# This is done using Device Cloud DeviceCore functionality
print "== Connected Devices =="
for device in dc.devicecore.get_devices():
    if device.is_connected():
        print device.get_mac()

# get the name and current value of all data streams having values
# with a floating point type
#
# This is done using Device Cloud stream functionality
for stream in dc.streams.get_streams():
    if stream.get_data_type().lower() in ('float', 'double'):
        print "%s -> %s" % (stream.get_stream_id(), stream.get_current_value())

For more examples and detailed documentation, be sure to checkout out the Full API Documentation.

Installation

This library can be installed using pip. Python versions 2.7+ and 3+ are supported by the library.

pip install devicecloud

If you already have an older version of the library installed, you can upgrade to the latest version by doing

pip install --upgrade devicecloud

Supported Features

Eventually, it is hoped that there will be complete feature parity between Device Cloud API and this library. For now, however, that is not the case. The current features are supported by the library:

  • Getting basic device information via DeviceCore
  • Provision and Delete devices via DeviceCore
  • Listing devices associated with a device cloud account
  • Interacting with Device Cloud Data Streams
    • Create Streams
    • Get Stream (by id)
    • List all streams
    • Get metadata for a stream
    • Write a single datapoint to a stream
    • Write many datapoints to a stream (homogeneous bulk write)
    • Write many datapoints to multiple streams (heterogeneous bulk write)
    • Read data points from a stream (includes control over order of returned data set as well as allowing for retrieving data roll-ups, etc.)
  • Support for accessing Device Cloud FileData store
    • Get filedata matching a provided condition (path, file extension, size, etc.)
    • Write files to filedata store
    • Recursively walk filedata directory tree from some root location
    • Get full metadata and contents of files and directories.
  • Low level support for performing basic SCI commands with limited parsing of results and support for only a subset of available services/commands.
  • APIs to make direct web service calls to Device Cloud with some details handled by the library (see DeviceCloudConnection and 'ws' documentation)
  • Device Provisioning via Mac Address, IMEI or Device ID
  • Monitors
  • Creating a TCP or HTTP monitor

The following features are not supported at this time. Feedback on which features should be highest priority is always welcome.

  • Alarms
  • Scheduled Operations
  • Asynchronous SCI requests
  • High level access to many SCI/RCI operations
  • DeviceMetaData
  • DeviceVendor
  • FileDataHistory
  • NetworkInterface support
  • XBee specific support (XBeeCore)
  • Smart Energy APIs
  • SMS Support
  • SM/UDP Support
  • Carrier Information Access

Contributing

Contributions to the library are very welcome in whatever form can be provided. This could include issue reports, bug fixes, or features additions. For issue reports, please create an issue against the Github project.

For code changes, feel free to fork the project on Github and submit a pull request with your changes. Additional instructions for developers contributing to the project can be found in the Developer's Guide.

License

This software is open-source software.

Copyright (c) 2015-2018 Digi International Inc.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain one at https://mozilla.org/MPL/2.0/.

Digi, Digi International, the Digi logo, the Digi website, Digi Device Cloud, Digi Remote Manager, and Digi Cloud Connector are trademarks or registered trademarks of Digi International Inc. in the United States and other countries worldwide. All other trademarks are the property of their respective owners.

THE SOFTWARE AND RELATED TECHNICAL INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL DIGI OR ITS SUBSIDIARIES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE AND TECHNICAL INFORMATION HEREIN, INCLUDING ALL SOURCE AND OBJECT CODES, IRRESPECTIVE OF HOW IT IS USED. YOU AGREE THAT YOU ARE NOT PROHIBITED FROM RECEIVING THIS SOFTWARE AND TECHNICAL INFORMATION UNDER UNITED STATES AND OTHER APPLICABLE COUNTRY EXPORT CONTROL LAWS AND REGULATIONS AND THAT YOU WILL COMPLY WITH ALL APPLICABLE UNITED STATES AND OTHER COUNTRY EXPORT LAWS AND REGULATIONS WITH REGARD TO USE AND EXPORT OR RE-EXPORT OF THE SOFTWARE AND TECHNICAL INFORMATION.

python-devicecloud's People

Contributors

aaschulz avatar brandonmoser avatar cmkline avatar ctrlaltdel avatar dependabot[bot] avatar kurte261 avatar posborne avatar rtzoeller avatar tpmanley avatar varzac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-devicecloud's Issues

Expired Device Cloud certificate

The Device Cloud certificate attached to the project (devicecloud/data/devicecloud.crt) expired last year. Also, I have noticed that it is not included in the latest pypi distribution package (0.5.7).

TCP monitor error

{'cstId': '13319', 'monBatchDuration': '10', 'monBatchSize': '1', 'monCompression': 'zlib', 'monFormatType': 'json', 'monId': '216834', 'monStatus': 'INACTIVE', 'monTopic': 'DeviceCore,FileDataCore,FileData,DataPoint', 'monTransportType': 'tcp'} Traceback (most recent call last): File "monitor_playground.py", line 65, in <module> test_tcp_monitor(dc) File "monitor_playground.py", line 27, in test_tcp_monitor mon.add_callback(listener) File "/Users/Hydex/Downloads/python-devicecloud-master/virtual/lib/python3.5/site-packages/devicecloud/monitor.py", line 379, in add_callback self._tcp_client_manager.create_session(callback, self._id) File "/Users/Hydex/Downloads/python-devicecloud-master/virtual/lib/python3.5/site-packages/devicecloud/monitor_tcp.py", line 558, in create_session session.start() File "/Users/Hydex/Downloads/python-devicecloud-master/virtual/lib/python3.5/site-packages/devicecloud/monitor_tcp.py", line 286, in start raise exception File "/Users/Hydex/Downloads/python-devicecloud-master/virtual/lib/python3.5/site-packages/devicecloud/monitor_tcp.py", line 281, in start self.socket.connect((self.client.hostname, PUSH_SECURE_PORT)) File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 1014, in connect self._real_connect(addr, False) File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 1005, in _real_connect self.do_handshake() File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 983, in do_handshake self._sslobj.do_handshake() File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 628, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.