Skip to main content

BCHydro API

Project description

BCHydro API

PyPi publish PyPi version

BCHydro Python API for extracting electricity usage statistics from your personal account.

Installation

Via PyPi:

pip install bchydro

Via Github:

git clone https://github.com/emcniece/bchydro.git
cd bchydro
pip install -r requirements.txt

Usage

Running the example script:

pip install bchydro

export BCH_USER=your.email@domain.com
export BCH_PASS=your-bch-password

python test.py

Using in a project:

import asyncio
from bchydro import BCHydroApi

async def main():
    a = BCHydroApi()
    await a.authenticate("username", "password")

    usage = await a.get_usage(hourly=False)
    print(usage.electricity)
    print(a.get_latest_point())
    print(a.get_latest_usage())
    print(a.get_latest_cost())

asyncio.run(main())

BCHydro offers view-only accounts, as a more secure option.

Version Publishing

This repo is automatically published to PyPi by means of a Github Workflow when a new release is created on Github.

Todo

  • Publish on release, not tag
  • Handle account locking (looks for HTML alert dialogs)
  • Unit tests

Disclaimer

This package has been developed without the express permission of BC Hydro. It accesses data by submitting forms that end-users would typically use in a browser. I'd love to work with BC Hydro to find a better way to access this data, perhaps through an official API... if you know anyone that works there, pass this along!

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

bchydro-0.7.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

bchydro-0.7-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

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