PyFlumeNG 0.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyflume/__init__.py +97 -0
- pyflume/auth.py +390 -0
- pyflume/client.py +1385 -0
- pyflume/constants.py +31 -0
- pyflume/data.py +226 -0
- pyflume/devices.py +70 -0
- pyflume/errors.py +57 -0
- pyflume/leak.py +83 -0
- pyflume/models.py +681 -0
- pyflume/notifications.py +138 -0
- pyflume/py.typed +1 -0
- pyflume/rate_limit.py +52 -0
- pyflume/types.py +48 -0
- pyflume/usage.py +265 -0
- pyflume/utils.py +140 -0
- pyflumeng-0.9.0.dist-info/METADATA +149 -0
- pyflumeng-0.9.0.dist-info/RECORD +20 -0
- pyflumeng-0.9.0.dist-info/WHEEL +5 -0
- pyflumeng-0.9.0.dist-info/licenses/LICENSE +21 -0
- pyflumeng-0.9.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PyFlumeNG
|
|
3
|
+
Version: 0.9.0
|
|
4
|
+
Summary: Complete Flume API client with Personal API and portal capabilities
|
|
5
|
+
Home-page: https://github.com/BookCatKid/PyFlumeNG
|
|
6
|
+
Author: ChrisMandich
|
|
7
|
+
Author-email: Chris@Mandich.net
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: pyjwt
|
|
15
|
+
Requires-Dist: ratelimit
|
|
16
|
+
Requires-Dist: requests
|
|
17
|
+
Requires-Dist: backports.zoneinfo; python_version < "3.9"
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: classifier
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: description-content-type
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: license
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: requires-dist
|
|
27
|
+
Dynamic: requires-python
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
# PyFlumeNG
|
|
31
|
+
|
|
32
|
+
PyFlumeNG is a fork and superset of PyFlume. It keeps the existing `pyflume`
|
|
33
|
+
import package and legacy helpers while adding the customer-portal OAuth flow,
|
|
34
|
+
portal write operations, typed resource models, pagination, response/error
|
|
35
|
+
handling, rate-limit state, and the endpoint surface used by Flume's customer
|
|
36
|
+
portal.
|
|
37
|
+
|
|
38
|
+
Install PyFlumeNG from PyPI:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install PyFlumeNG
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Authentication
|
|
45
|
+
|
|
46
|
+
PyFlumeNG supports two ways to obtain a Flume bearer token. They are not tied
|
|
47
|
+
to separate sets of read helpers: ordinary reads such as devices,
|
|
48
|
+
notifications, leaks, usage alerts, and queries can be used with either auth
|
|
49
|
+
object. The main difference is how the token is obtained and what scopes Flume
|
|
50
|
+
grants it.
|
|
51
|
+
|
|
52
|
+
| Auth class | Credentials | Best fit | Portal-only writes |
|
|
53
|
+
| --- | --- | --- | --- |
|
|
54
|
+
| `PersonalAuth` / `FlumeAuth` | Email, password, API client ID, API client secret | Flume's documented Personal API flow | No |
|
|
55
|
+
| `PortalAuth` / `FlumePortalAuth` | Email and password | Customer-portal flow and code that needs the portal's broader token | Yes |
|
|
56
|
+
|
|
57
|
+
`PersonalAuth` and `FlumeAuth` are the same class. Use them when you want the
|
|
58
|
+
documented Personal API password-grant flow with credentials generated from
|
|
59
|
+
Flume's API Access settings:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import pyflume
|
|
63
|
+
|
|
64
|
+
auth = pyflume.PersonalAuth(
|
|
65
|
+
username="your_email",
|
|
66
|
+
password="your_password",
|
|
67
|
+
client_id="your_client_id",
|
|
68
|
+
client_secret="your_client_secret",
|
|
69
|
+
)
|
|
70
|
+
client = pyflume.FlumeClient(auth)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`PortalAuth` and `FlumePortalAuth` are the same class. This flow uses the same
|
|
74
|
+
customer-portal OAuth path as Flume's web app and needs only the account
|
|
75
|
+
credentials:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import pyflume
|
|
79
|
+
|
|
80
|
+
auth = pyflume.PortalAuth(
|
|
81
|
+
username="your_email",
|
|
82
|
+
password="your_password",
|
|
83
|
+
)
|
|
84
|
+
client = pyflume.FlumeClient(auth)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
You can use that `PortalAuth` object for normal reads too. For example,
|
|
88
|
+
`client.list_notifications()`, `FlumeNotificationList(auth)`,
|
|
89
|
+
`client.list_devices()`, and `FlumeData(...)` all accept it. Portal auth becomes
|
|
90
|
+
required when an operation needs a scope that Flume does not grant to a normal
|
|
91
|
+
Personal API token, including the portal usage-alert rule write routes.
|
|
92
|
+
|
|
93
|
+
See [Authentication](docs/auth.md) for the full distinction, including which
|
|
94
|
+
auth mode to choose and how the legacy helpers behave.
|
|
95
|
+
|
|
96
|
+
## Typed API
|
|
97
|
+
|
|
98
|
+
Named resource methods return typed models. For example:
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
user = client.get_user() # Optional[User]
|
|
102
|
+
devices = client.list_devices() # list[Device]
|
|
103
|
+
rules = client.list_usage_alert_rules("device") # list[UsageAlertRule]
|
|
104
|
+
accuracy = client.get_meter_accuracy("device") # list[AccuracyResult]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Models expose known API fields to type checkers and IDEs while remaining
|
|
108
|
+
forward-compatible with Flume additions. Unknown response fields remain
|
|
109
|
+
available as attributes or mapping keys and are preserved by `to_dict()`.
|
|
110
|
+
|
|
111
|
+
`pyflume` ships a `py.typed` marker so installed type checkers can consume the
|
|
112
|
+
package annotations. The complete method signatures and model fields are in the
|
|
113
|
+
[generated API reference](docs/api-reference.md).
|
|
114
|
+
|
|
115
|
+
## Endpoint coverage
|
|
116
|
+
|
|
117
|
+
`FlumeClient` includes the documented Personal API plus portal-discovered
|
|
118
|
+
routes for users, devices, current flow and queries, locations and location
|
|
119
|
+
profiles, notifications, usage alerts and rules, do-not-alert schedules,
|
|
120
|
+
budgets, subscriptions, emergency contacts, shared location access,
|
|
121
|
+
integrations and shutoff valves, spans and span types, feedback, meter
|
|
122
|
+
accuracy, support conversations, purchase options, insurers, professional
|
|
123
|
+
services, API clients, contacts, and subscription/Stripe portal operations.
|
|
124
|
+
|
|
125
|
+
List helpers follow Flume pagination and return all pages. `response()` exposes
|
|
126
|
+
the complete typed response envelope when pagination or metadata matters, and
|
|
127
|
+
`raw()` remains an escape hatch for routes added by Flume after this release.
|
|
128
|
+
See the [FlumeClient guide](docs/client.md) for the main interface.
|
|
129
|
+
|
|
130
|
+
## Legacy helpers
|
|
131
|
+
|
|
132
|
+
The original helper classes remain available and typed:
|
|
133
|
+
|
|
134
|
+
- [Data retrieval](docs/data.md)
|
|
135
|
+
- [Devices](docs/devices.md)
|
|
136
|
+
- [Leak alerts](docs/leak.md)
|
|
137
|
+
- [Notifications](docs/notifications.md)
|
|
138
|
+
- [Usage alerts](docs/usage.md)
|
|
139
|
+
|
|
140
|
+
## Development
|
|
141
|
+
|
|
142
|
+
The API reference is generated from source signatures and model annotations:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
python scripts/generate_api_reference.py
|
|
146
|
+
python scripts/generate_api_reference.py --check
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`tox` runs the tests, mypy, generated-reference check, and bytecode compilation.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
pyflume/__init__.py,sha256=K1XsP7PYcI_WnUowtizuNqF8RKtKuStA3eIcF3lhg4U,2095
|
|
2
|
+
pyflume/auth.py,sha256=ISMNApBnPLMgaMUG12HsU6fyVjxzIf8-hitVcv0N1RA,13620
|
|
3
|
+
pyflume/client.py,sha256=eDTug3J3l8UD0P_8mgr6tPbekF0E-3B3q7A_PEnt9gI,45457
|
|
4
|
+
pyflume/constants.py,sha256=nJdMps6UILnsjaOUZueQG2tGsp9ktq8mb5Ex2c_4MD0,1205
|
|
5
|
+
pyflume/data.py,sha256=U6hQ1TYi4VuwNvwej7cVwFYXRrtJQBWcL3wIQLWAcao,7969
|
|
6
|
+
pyflume/devices.py,sha256=gFnl6uJuOd-F26fGp9q6fhs3RRWLha9Dtrqscm-Zzbc,1994
|
|
7
|
+
pyflume/errors.py,sha256=o5X9cb6aCT47LEqbUWY3Fbot5-mwbF05lE5rpjLSvIs,1730
|
|
8
|
+
pyflume/leak.py,sha256=Fqgbgto3TXnh0lCs7h58H51I-qamk4srVWZWkqKDr9A,2500
|
|
9
|
+
pyflume/models.py,sha256=k62NMkZ4TSSJWhlrgPuHKohNV6_uPXK-YuSB2B8hPIs,17222
|
|
10
|
+
pyflume/notifications.py,sha256=fVj7p7M1wqyjpqJ92WPn0ag9uKAvplAK9GCaPS5wxzo,4686
|
|
11
|
+
pyflume/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
12
|
+
pyflume/rate_limit.py,sha256=THqinKj3vMaXJWTJUKktZGBWuCmF8hu7HB896OPAc8g,1826
|
|
13
|
+
pyflume/types.py,sha256=Jva82u8UNjb-WYKWHD0Gr4Iy44loxHwJm48Y3ZvvY_k,1224
|
|
14
|
+
pyflume/usage.py,sha256=24vCRs7nEXY-QoKsg0m9sOTgKLeHHY9s3S5T-7MSFpE,8519
|
|
15
|
+
pyflume/utils.py,sha256=CdkQtXzCcDWAoxXnl2GJ00dhc5ilP66Iuv6g7sgUiuU,3442
|
|
16
|
+
pyflumeng-0.9.0.dist-info/licenses/LICENSE,sha256=l7mqMe3Aab6si52wdgcRLD6G0Y6o-TL5C0yrdu_J8ZU,1070
|
|
17
|
+
pyflumeng-0.9.0.dist-info/METADATA,sha256=ZWQXLXAd-4WIA5LijnsRwosxPI-VNo34rIAvCme5Anc,5209
|
|
18
|
+
pyflumeng-0.9.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
19
|
+
pyflumeng-0.9.0.dist-info/top_level.txt,sha256=RtPYwHpLrv5ugCdYrO7ckyNJeFyrmzcpw7cWyHxIPU8,8
|
|
20
|
+
pyflumeng-0.9.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Chris Mandich
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pyflume
|