PyFlumeNG
PyFlumeNG is a fork and superset of PyFlume. It uses the dedicated pyflumeng
import package and retains the legacy helpers while adding the customer-portal OAuth flow,
portal write operations, typed resource models, pagination, response/error
handling, rate-limit state, and the endpoint surface used by Flume's customer
portal.
Install PyFlumeNG from PyPI:
pip install PyFlumeNG
Authentication
PyFlumeNG supports two ways to obtain a Flume bearer token. They are not tied to separate sets of read helpers: ordinary reads such as devices, notifications, leaks, usage alerts, and queries can be used with either auth object. The main difference is how the token is obtained and what scopes Flume grants it.
| Auth class | Credentials | Best fit | Portal-only writes |
|---|---|---|---|
PersonalAuth / FlumeAuth |
Email, password, API client ID, API client secret | Flume's documented Personal API flow | No |
PortalAuth / FlumePortalAuth |
Email and password | Customer-portal flow and code that needs the portal's broader token | Yes |
PersonalAuth and FlumeAuth are the same class. Use them when you want the
documented Personal API password-grant flow with credentials generated from
Flume's API Access settings:
import pyflumeng
auth = pyflumeng.PersonalAuth(
username="your_email",
password="your_password",
client_id="your_client_id",
client_secret="your_client_secret",
)
client = pyflumeng.FlumeClient(auth)
PortalAuth and FlumePortalAuth are the same class. This flow uses the same
customer-portal OAuth path as Flume's web app and needs only the account
credentials:
import pyflumeng
auth = pyflumeng.PortalAuth(
username="your_email",
password="your_password",
)
client = pyflumeng.FlumeClient(auth)
You can use that PortalAuth object for normal reads too. For example,
client.list_notifications(), FlumeNotificationList(auth),
client.list_devices(), and FlumeData(...) all accept it. Portal auth becomes
required when an operation needs a scope that Flume does not grant to a normal
Personal API token, including the portal usage-alert rule write routes.
See Authentication for the full distinction, including which auth mode to choose and how the legacy helpers behave.
Typed API
Named resource methods return typed models. For example:
user = client.get_user() # Optional[User]
devices = client.list_devices() # list[Device]
rules = client.list_usage_alert_rules("device") # list[UsageAlertRule]
accuracy = client.get_meter_accuracy("device") # list[AccuracyResult]
Models expose known API fields to type checkers and IDEs while remaining
forward-compatible with Flume additions. Unknown response fields remain
available as attributes or mapping keys and are preserved by to_dict().
Higher-level typed helpers are available for common dashboard data as well:
get_usage_breakdown() combines classified spans with a whole-window SUM query,
rolls raw irrigation into Outdoor, derives Indoor as the unclassified residual,
and returns category usage/percentages. Budget exposes used, target,
remaining, percentage_used, and is_over_budget progress properties.
Portal semantic helpers additionally cover notification preference bitmasks
without dropping unknown bits, structured usage-alert history, AVG notification
detail, validated usage-rule/Smart-Leak and Do Not Alert payloads, and
percentage-based budget configuration.
Custom usage-alert validation includes the live API rule that repeat
notifications must be at least twice the alert duration. If callers omit
notify_every, PyFlumeNG uses the safe minimum 2 * duration automatically.
pyflumeng ships a py.typed marker so installed type checkers can consume the
package annotations. The complete method signatures and model fields are in the
generated API reference.
Endpoint coverage
FlumeClient includes the documented Personal API plus portal-discovered
routes for users, devices, current flow and queries, locations and location
profiles, notifications, usage alerts and rules, do-not-alert schedules,
budgets, subscriptions, emergency contacts, shared location access,
integrations and shutoff valves, spans and span types, feedback, meter
accuracy, support conversations, purchase options, insurers, professional
services, API clients, contacts, and subscription/Stripe portal operations.
List helpers follow Flume pagination and return all pages. response() exposes
the complete typed response envelope when pagination or metadata matters, and
raw() remains an escape hatch for routes added by Flume after this release.
See the FlumeClient guide for the main interface.
Customer-portal responses have been observed advertising a 72,000-request
quota through X-RateLimit-Limit. The accompanying reset epoch varies between
live requests and should not be treated as a fixed midnight reset.
FlumeClient.rate_limit tracks the live server-reported limit, remaining
requests, reset time, and Retry-After value so frequent pollers can budget
requests from the current quota state. See
Authentication for details.
Legacy helpers
The original helper classes remain available and typed:
Examples
The examples include an interactive portal utility that lists usage-alert rules and explicitly enables or disables the selected rule.
Development
The API reference is generated from source signatures and model annotations:
python scripts/generate_api_reference.py
python scripts/generate_api_reference.py --check
tox runs the tests, mypy, generated-reference check, and bytecode compilation.
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 pyflumeng-0.12.0.tar.gz.
File metadata
- Download URL: pyflumeng-0.12.0.tar.gz
- Upload date:
- Size: 50.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
040a811745845537ad0bce59638228cbd7a6c7b57cff2c4116f8eaea326c70e5
|
|
| MD5 |
6772dd3e9a59b3804e732cf629e462bd
|
|
| BLAKE2b-256 |
e7a109325500d39a607dca5f5ad4573e6e640378cc1d1191be3c7103daf9e559
|
Provenance
The following attestation bundles were made for pyflumeng-0.12.0.tar.gz:
Publisher:
python-public-release.yml on BookCatKid/PyFlumeNG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflumeng-0.12.0.tar.gz -
Subject digest:
040a811745845537ad0bce59638228cbd7a6c7b57cff2c4116f8eaea326c70e5 - Sigstore transparency entry: 2753565018
- Sigstore integration time:
-
Permalink:
BookCatKid/PyFlumeNG@06b8e4ae1b578c5c6b116d248f223e53623dd23e -
Branch / Tag:
refs/heads/master - Owner: https://github.com/BookCatKid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-public-release.yml@06b8e4ae1b578c5c6b116d248f223e53623dd23e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pyflumeng-0.12.0-py3-none-any.whl.
File metadata
- Download URL: pyflumeng-0.12.0-py3-none-any.whl
- Upload date:
- Size: 43.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
627de243ffa091e44b16f8552432089185296bc59bf595bf0bfa6e9e35f085f3
|
|
| MD5 |
a2b7af9ec138c8bc54a32ee49d3c613a
|
|
| BLAKE2b-256 |
49c53c61c0891c87e6d252a2d22555720e95fe763f6719b98be790c493d78117
|
Provenance
The following attestation bundles were made for pyflumeng-0.12.0-py3-none-any.whl:
Publisher:
python-public-release.yml on BookCatKid/PyFlumeNG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflumeng-0.12.0-py3-none-any.whl -
Subject digest:
627de243ffa091e44b16f8552432089185296bc59bf595bf0bfa6e9e35f085f3 - Sigstore transparency entry: 2753565037
- Sigstore integration time:
-
Permalink:
BookCatKid/PyFlumeNG@06b8e4ae1b578c5c6b116d248f223e53623dd23e -
Branch / Tag:
refs/heads/master - Owner: https://github.com/BookCatKid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-public-release.yml@06b8e4ae1b578c5c6b116d248f223e53623dd23e -
Trigger Event:
workflow_dispatch
-
Statement type: