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)
Tariff
Thames Water has no tariff API — metered charges are a fixed annual "Scheme of Charges" published per region (identical for every customer), so the figures are scraped from Thames Water's public metered-customers help page and need no authentication:
from thameswaterapi import get_tariff
tariff = get_tariff()
tariff.clean_water_rate_per_m3 # 2.7346
tariff.wastewater_rate_per_m3 # 1.4721
tariff.water_fixed_per_year # 66.87
tariff.wastewater_fixed_per_year # 128.13 (standard rate, not the rebate)
tariff.volumetric_rate_per_m3 # combined GBP/m3
tariff.unit_rate_per_litre # combined GBP/L
tariff.standing_charge_per_day # combined fixed charge GBP/day
ThamesWater.get_tariff() is also available on an authenticated client (it
reuses the session).
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
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.4.0.tar.gz.
File metadata
- Download URL: thameswaterapi-0.4.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
314029452c546bf3b5d332dbbdb9ee16b09df499020a627fbe8167d335c0af79
|
|
| MD5 |
34245e00f2a51eac13dc37431128b41d
|
|
| BLAKE2b-256 |
ce98bfb7f4100f9639bb77e428967161a26a76a77aff987aa4b9ddbfb931f56a
|
File details
Details for the file thameswaterapi-0.4.0-py3-none-any.whl.
File metadata
- Download URL: thameswaterapi-0.4.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e76a02d59bbb3c78a955cc32c6a5591327d48be5fb0899d959c4fb47f824c9dd
|
|
| MD5 |
c64236bbe86cd7a1757bcd052d5a1e32
|
|
| BLAKE2b-256 |
9dc267c668ca011f16499a89010af0bdb5532629104bc686b378dea6aeb7276b
|