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 account settings by id**
``client.get_account_settings(account_id=123)``
**Get account live balances**
``client.get_live_balances(account_id=123)``
``client.get_live_balances_detailed(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 the account id currently associated with an MPAN core id or MPRN**
``client.get_account_for_meter_point(meter_point_id='9910000001507')``
**Get the PES Area for a postcode** (`<http://www.energybrokers.co.uk/electricity/PES-Distributor-areas.htm>`_)
``client.get_region_id_for_postcode(postcode='se14yu')``
**Get gas utility information for a MPRN (meter point reference number)**
``client.get_gas_utility(mprn='3226987202')``
**Get electricity utility information for a MPAN CORE ID (meter point administration number)**
``client.get_electricity_utility(mpan_core_id='3226987202')``
**Create a meter reading**
``client.create_meter_reading(account_id=1507, source='SMART', meter_point_id=1597, register_id=1496, value=2.0, timestamp=datetime(2018, 7, 24, 13, 49, 34, 661562, tzinfo=timezone.utc))``
**Get readings for a meter point**
``client.get_meter_point_readings(meter_point_id=1597)``
**Get all customer account ids**
``client.get_all_account_ids()``
**Get addresses at a postcode**
``client.get_addresses_at_postcode(postcode='se14yu')``
**Get account attributes**
```python
client.get_account_attributes(account_id=1597)
```
**Update account attribute**
```python
client.update_account_attribute(
account_id=1597,
name='PaymentType',
value='some-value',
type='string',
)
```
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
Releasing to PyPI
-----------------
.. code:: bash
pip install zest.releaser
fullrelease
.. |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
Metadata
Release files for ENSEK 1.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ENSEK-1.8.0.tar.gz | 18.9 kB | Without provenance | Details for ENSEK-1.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ENSEK-1.8.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for ENSEK-1.8.0-py2.py3-none-any.whl |
Total release size: 23.8 kB
Release files / ENSEK-1.8.0.tar.gz
| Download URL | ENSEK-1.8.0.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a0ffb096e8e0bceca6ff88ad60935bd79fdb259e129bdb18bda7713d78d59c0
|
|
BLAKE2b-256 checksum How to use checksums |
412dda167af93286b58436a6ff0dbb30de8f44e8920f4364c1413ae1d8ebb3a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.4
|
Release files / ENSEK-1.8.0-py2.py3-none-any.whl
| Download URL | ENSEK-1.8.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
631c7d0caacc3048ad88678289033ccd7840eb3a9cab83ede2a54253f0efe16a
|
|
BLAKE2b-256 checksum How to use checksums |
8debb21a81045d2b6ae50bf8fc81daa9e84d7793511246f228320799ca089796
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.4
|
Security for ENSEK 1.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.