Metadata-Version: 2.1
Name: ENSEK
Version: 0.2.0
Summary: Python Client for the ENSEK API (http://www.ensek.co.uk/) 
Home-page: https://github.com/Usio-Energy/ENSEK
Author: Richard O'Dwyer
Author-email: richard@richard.do
License: Apache 2
Platform: UNKNOWN
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.6.0
Requires-Dist: requests (>=0.10)
Requires-Dist: wheel (>=0.30.0)
Requires-Dist: setuptools (>=39.0.1)
Requires-Dist: stringcase (==1.2.0)


ENSEK
=======

|PyPI| |Python Versions| |Build Status|

🐍 Python Client for the ENSEK API (http://www.ensek.co.uk/)
This client does not implement all the features of the API, pull requests are very welcome to expand functionality.

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

To install ensek, simply:

.. code:: bash

    pip install ensek

How To Use
----------

Initialise the client
~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    from ensek import Ensek
    client = Ensek(
        api_url='https://api.usio.ignition.ensek.co.uk/',
        api_key='fill_this_in',
    )

Available methods
~~~~~~~~~~~~~~~~~

**Get an account by id**

``client.get_account(account_id=123)``

**Get tariffs for an account by id**

``client.get_account_tariffs(account_id=123)``

**Get meter points for an account by id**

``client.get_meter_points(account_id=123)``

**Get recent newly registered accounts**

``client.get_completed_signups()``

**Get the account id currently associated with an MPAN core id**

``client.get_account_for_meter_point(mpan_core_id='9910000001507')``

**Get the [PES Area](http://www.energybrokers.co.uk/electricity/PES-Distributor-areas.htm) for a postcode**

``client.get_region_id_for_postcode(postcode='se14yu')``

Note: For each client method:

- If API response is 404, method will raise ``LookupError``.
- If API response is between 400 and 499, method will raise ``ValueError``.
- For any other bad status code ``EnsekError`` will raise.


Requirements
------------

::

    1. Python 3.6+
    2. See requirements.txt

Running the tests
-----------------

.. code:: bash

    pip install -r requirements-test.txt
    pytest

.. |PyPI| image:: https://img.shields.io/pypi/v/ensek.svg
   :target: https://pypi.python.org/pypi/ensek
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/ensek.svg
   :target: https://pypi.python.org/pypi/ensek
.. |Build Status| image:: https://travis-ci.org/Usio-Energy/ensek.png?branch=master
   :target: https://travis-ci.org/Usio-Energy/ensek


