Skip to main content


Project description


PyPi version Tested Python versions PyPi publish PyPi downloads Dependency updates

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


Via PyPi:

pip install bchydro

Via Github:

# Fetch the code
git clone
cd bchydro

# Set up environment

pip install -r requirements.txt


Running the example script:

pip install bchydro

export BCH_PASS=your-bch-password


Using in a project:

import asyncio
from bchydro import BCHydroApi

async def main():
    bch = BCHydroApi("username", "password")

    # Asynchronous usage:
    print(await bch.get_usage())
    print(await bch.get_latest_point())
    print(await bch.get_latest_usage())
    print(await bch.get_latest_interval())
    print(await bch.get_latest_cost())

    # Mostly synchronous usage:
    await bch.refresh()

⚠ Read-Only Account Sharing

This project accesses your BCHydro account as would a human in a browser. It is recommended that a read-only account is set up for use with this project for more secure operation. Using this secondary account also enables backup access in the event of account lockout.

Version Publishing

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


Dependencies can be updated with pip-tools:

# Install pip-compile and pip-sync
pip install pip-tools

# Upgrade requirements
pip-compile --upgrade


  • Publish on release, not tag
  • Handle account locking (looks for HTML alert dialogs)
  • Unit tests
  • Automatic initial and re-authentication
  • Rate limiting, auth retries
  • Exception documentation


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.8.1.tar.gz (8.6 kB view hashes)

Uploaded source

Built Distribution

bchydro-0.8.1-py3-none-any.whl (8.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page