Skip to main content

Python bindings for Exosite API over HTTP JSON RPC.

Project description

About pyonep
============

This project contains a package called "pyonep". The pyonep package is an
API library with python bindings to the Exosite One Platform API. The API is
exposed over HTTP in a JSON RPC style interface.

Recommended with python 2.6 or later.

License is BSD, Copyright 2011, Exosite LLC (see LICENSE file)


Installation
------------

```bash

$ git clone https://github.com/exosite-labs/pyonep
$ cd pyonep
$ python setup.py install
```

Note: If you'd rather not install the package, you can also copy the
./pyonep/pyonep folder into the same folder as your script, or
add the ./pyonep/pyonep folder to your sys.path.

If you're running a version of python earlier than 2.6 you'll need the
python-simplejson package, available here:

https://pypi.python.org/pypi/simplejson/


Getting A CIK
-------------

Access to the Exosite API requires a Client Information Key (CIK). If
you're just getting started with the API and have signed up with a
community portal, here's how you can find a CIK:

1.) Log in: https://portals.exosite.com

2.) Click on "devices" on the menu on the left

3.) Click on a device to open its properties

4.) The device's CIK is displayed on the left

Once you have a CIK, you can substitute it in the examples below.


Usage
-----

Here's how to get information about a device:

```python

from pyonep import onep
from pprint import pprint

o = onep.OnepV1()

cik = 'INSERT_CIK'

pprint(o.info(
cik,
{'alias': ''}))
```


Buffered Access
---------------

The pyonep library includes a module that provides buffered access to the
RPC API, which may offer better performance in some cases.

See examples/read\_write\_record.py for more details.


Example Scripts
---------------

Examples are located in examples/. To run them, first modify them with your
device information.

- get_info.py - uses the onep module to send a single command

- mult_cmd.py - uses the onep module to send

- read_write_record.py - uses the datastore module for buffered access to the API,
which can be higher performance in some scenarios

- provisioning.py - uses the provision module to provision some

Note that to run the examples without installing the pyonep package, the
example script must be located in the root folder (with ./pyonep as a
sub-folder).

For a example that fully exercises the RPC interface, see the exosite command
line interface:

http://github.com/dweaver/exoline


General API Information
-----------------------

For more information on the API, see:

http://developers.exosite.com


History
=======

0.7.4 (2013-7-22)
-----------------

- fixed support for python 2.5
- added example of using onep.py directly

0.7.3 (2013-7-19)
-----------------

- fixed issue with format in python 2.6
- fixed exception messages

0.7.2 (2013-7-19)
-----------------

- updated provisioning library for api change to use "meta" field
- updated provisioning library to use vendor token by default
- improved logging
- fixed issue record offset is 0 in datastore
- reverted back to using distutils for python 2.6 support

0.7.1 (2013-7-18)
-----------------

- merge a few bug fixes from Exosite internal repo
- remove comment command
- fix multiple command example

0.7.0 (2013-7-18)
-----------------

- renamed onepv1lib package to pyonep
- renamed onep_exceptions back to exceptions

0.6
---

- add usage command

0.5
---

- add support for https

0.4
---

- add support for sending multiple commands in a single request

0.3
---

- add provisioning library

0.2
---

- update example code

0.1
---

- initial version

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

pyonep-0.7.4.tar.gz (14.5 kB view hashes)

Uploaded Source

Supported by

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