A Python client for retrieving hourly meter data from Thames Water
Project description
thameswaterapi
pip install thameswaterapi
A Python client for retrieving meter data from Thames Water.
This is a fork of thameswaterclient by Ayrton Bourn.
Python API
from thameswaterapi import ThamesWater
email = 'myname@provider.com'
password = '**********'
thames_water = ThamesWater(email=email, password=password)
If you have multiple accounts, you can specify which one to use:
thames_water = ThamesWater(email=email, password=password, account_number=123456789)
Listing accounts and meters
thames_water.get_account_numbers() # [123456789011, 123456789012]
thames_water.get_meter_numbers() # ['123456789']
Daily usage
from thameswaterapi import lines_to_timeseries
meters = thames_water.get_meters()
readings = lines_to_timeseries(meters.Lines)
for r in readings:
print(r.start, r.usage, r.total)
Hourly usage
import datetime
from thameswaterapi import meter_usage_lines_to_timeseries
meter = thames_water.get_meter_numbers()[0]
start = datetime.datetime(2024, 10, 1)
end = datetime.datetime(2024, 10, 2)
meter_usage = thames_water.get_meter_usage(meter, start, end)
readings = meter_usage_lines_to_timeseries(start, meter_usage.Lines)
for r in readings:
print(r.hour_start, r.usage, r.total)
Command line
python -m thameswaterapi EMAIL PASSWORD [options]
Options:
--account-number N— use a specific contract account number (defaults to the account default)--list-accounts— list available contract account numbers and exit--list-meters— list meter serial numbers and exit--meter M— query a specific meter (defaults to first meter)
Examples:
# Show daily and hourly readings for the default account and first meter
python -m thameswaterapi myname@provider.com mypassword
# List available account numbers
python -m thameswaterapi myname@provider.com mypassword --list-accounts
# List meters on a specific account
python -m thameswaterapi myname@provider.com mypassword --account-number 123456789012 --list-meters
# Query a specific meter
python -m thameswaterapi myname@provider.com mypassword --meter 123456789
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file thameswaterapi-0.2.0.tar.gz.
File metadata
- Download URL: thameswaterapi-0.2.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbb3b9060d565f6507ab0a13df54d4895fc1c89f39415b9b33027fa125c14188
|
|
| MD5 |
2332a687c7114df8d56855f9f3e58fe2
|
|
| BLAKE2b-256 |
72171fe4aace2862e5eaba81ab358556aadef72deca1930f92d6e3345036be20
|
File details
Details for the file thameswaterapi-0.2.0-py3-none-any.whl.
File metadata
- Download URL: thameswaterapi-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00303c6f871bd79c689a57a96e71f61a7883694c4789b00681d3b0294c848d39
|
|
| MD5 |
4b3262a1c38a155b7601ec851363465e
|
|
| BLAKE2b-256 |
e694947e777f9b76f53e1efaf9e9a42c75a8d38fcd1651b04ea30007fb77e76a
|