Skip to main content

Python Client for the ENSEK API (http://www.ensek.co.uk/)

Project description

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:

pip install ensek

How To Use

Initialise the client

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')

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

pip install -r requirements-test.txt
pytest

Releasing to PyPI

pip install zest.releaser
fullrelease

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

ENSEK-1.6.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

ENSEK-1.6.0-py2.py3-none-any.whl (4.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ENSEK-1.6.0.tar.gz.

File metadata

  • Download URL: ENSEK-1.6.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for ENSEK-1.6.0.tar.gz
Algorithm Hash digest
SHA256 8e407abd314d4b401aebae5817639b7955e64fa1473770d21d7990507cf3fce8
MD5 51d35876158fcc76531f3ee502bef1bd
BLAKE2b-256 66a1e6be15d0b343103e41644669ef1fda665002c0d98b399b2794d8967bee05

See more details on using hashes here.

File details

Details for the file ENSEK-1.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: ENSEK-1.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for ENSEK-1.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d9a9fb12f9595dcddc010f4884a6970df204b85b775131baf261a2957006ee4a
MD5 d60dcfaa4ced62ac48a3ffd1f3c00299
BLAKE2b-256 8fe3bb9af435d0b2fcdcbb55b0c3b214bf54a2e9c80b37f417a50f341d535991

See more details on using hashes here.

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