__Warning__: version 0.8.0 requires changes to applications that used earlier versions of the provision module. See below for information about [migrating your applications from 0.7.x to 0.8.0](#migrating-to-080)

Note that this library does not yet support the HTTP Data Interface. Seebelow for more information.

- [read_write_buffered.py](examples/read_write_buffered.py) - demonstrates use of the datastore module

- [provisioning.py](examples/provisioning.py) - demonstrates use of the provisioning API

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 Python example that fully exercises the RPC interface using the pyonep library, see the Exosite command line interface:

http://github.com/exosite/exoline

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

For more information on the API, see:

https://github.com/exosite/api

HTTP Data Interface-------------------

The HTTP Data Interface is a minimal HTTP API best suited to resource-constrained devices or networks. It is limited to reading and writing data one point at a time. An example of using Python to access this interface is here:

https://github.com/exosite-garage/python_helloworld

The API is documented here:

https://github.com/exosite/api/tree/master/data

Migration from version 0.3--------------------------

If you were previously using version 0.3 and want to upgrade to 0.7.4,you will need to update the package name in your scripts. The package namewas updated from onepv1lib to pyonep. For example:

```bash

from onepv1lib import onep```

...should be changed to:

```bash

from pyonep import onep```

A global search and replace of onepv1lib to pyonep in your scripts should work.

Migrating to 0.8.0------------------

Version 0.8.0 includes some breaking changes to provision module API to provide more consistent return values and error information. To migrate an existing application to pyonep 0.8.0 you will need to make a few changes to the way provision methods are called.

- Previously, methods in provision module either returned a.) `True` (success) or `False` (failure) or b.) `<response body="" string="">` (success) or `None` (failure). HTTP response details (e.g. status code) were not available to the caller without turning on logging and parsing stdout. With 0.8.0 all methods return a `ProvisionResponse` object with the following properties:

- `ProvisionResponse.body` is the response body, a string. The contents of this depend on the specific call, and may be of length 0. See [provision API documentation](https://github.com/exosite/api/tree/master/provision) for details. - `ProvisionResponse.status` is the HTTP status code - `ProvisionResponse.isok` is a boolean representing whether the call succeeded (i.e. if the status code is < 400)

- Previously all exceptions associated with a call were being caught but not rethrown. With 0.8.0, HTTP exceptions are thrown to the caller. For example, if no connection is available, previously this would have written a message to the log and returned `None`. Now, a subclass of [`HTTPException`](http://docs.python.org/2/library/httplib.html#httplib.HTTPException) is thrown to the caller. This allows the caller to take appropriate action based on exactly what happened.

Here's an example of code based pyonep before 0.8.0:```import pyonepprovision = pyonep.Provision('http://m2.exosite.com', manage_by_cik=False)

You can also ask the provision module to raise an exception for HTTP statuses of 400 and above by passing `raise_api_exceptions=True` to the `Provision` constructore. This can consolidate code that handles API errors for a large number of provision calls. See the [provisioning example](examples/provisioning.py) to see how to do this.

- return ProvisionResult from provision methods to provide more information about success/failure (breaking change)- refactor provision.py to use httplib, and share code with onep.py.- make version string available in pyonep.__version__, per PEP 396

- 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