No project description provided
Toronto Hydro offers a Green Button XML export through the customer portal, but does not offer programmatic API access. This script logs into the dashboard with Selenium, then downloads the report with Requests.
- a Toronto Hydro account
- Python 3.6+
- Firefox 57+ or Google Chrome and ChromeDriver
Install with pip:
pip install toronto-hydro-green-button
The script needs your username and password to log into the dashboard. It will check, in order of precedence:
- prompt input
--end-date to query data between two dates (inclusive).
$ toronto-hydro-green-button --start-date 2019-11-01 --end-date 2019-11-31
If ChromeDriver is installed, the script attempts to use it by default. Otherwise it falls back on headless Firefox. ChromeDriver was slightly faster in my limited testing.
toronto-hydro-green-button --help for additional usage information.
Toronto Hydro usage data lags by 2–3 days. This script defaults to querying data from two days ago.
If you run this script frequently, you may not always see fresh data. It should be sufficient to run it daily.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size toronto-hydro-green-button-0.1.0.tar.gz (4.1 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for toronto-hydro-green-button-0.1.0.tar.gz