meterbase 0.4.0__tar.gz → 0.4.1__tar.gz
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.
- {meterbase-0.4.0 → meterbase-0.4.1}/PKG-INFO +5 -5
- {meterbase-0.4.0 → meterbase-0.4.1}/README.md +4 -4
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/client.py +4 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/resources/customers.py +1 -1
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/client.py +4 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/resources/customers.py +1 -1
- meterbase-0.4.1/src/meterbase/_version.py +1 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/errors.py +7 -2
- meterbase-0.4.0/src/meterbase/_version.py +0 -1
- {meterbase-0.4.0 → meterbase-0.4.1}/.gitignore +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/LICENSE +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/pyproject.toml +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/__init__.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/__init__.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/_io.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/_transport.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/resources/__init__.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/resources/customer_allowances.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/resources/customer_periods.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/resources/customer_plan.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/resources/meters.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_async/resources/plans.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_http.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_json.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_keys.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_models.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_not_given.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/__init__.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/_io.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/_transport.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/resources/__init__.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/resources/customer_allowances.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/resources/customer_periods.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/resources/customer_plan.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/resources/meters.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_sync/resources/plans.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/_time.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/py.typed +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/resources.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/types.py +0 -0
- {meterbase-0.4.0 → meterbase-0.4.1}/src/meterbase/webhooks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: meterbase
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Python SDK for the Meterbase engine
|
|
5
5
|
Project-URL: Homepage, https://meterbase.tech
|
|
6
6
|
Project-URL: Documentation, https://meterbase.tech/docs
|
|
@@ -328,12 +328,12 @@ identified. `None` means they hold no plan, which is a default deny — a
|
|
|
328
328
|
customer with no plan and no grant is denied.
|
|
329
329
|
|
|
330
330
|
**Lists come a page at a time.** `customers.list` answers one page, newest
|
|
331
|
-
first: `limit` customers, 100 unless you set it and at most
|
|
331
|
+
first: `limit` customers, 100 unless you set it and at most 100. `list_all`
|
|
332
332
|
follows the pages for you, fetching each one as the loop reaches it:
|
|
333
333
|
|
|
334
334
|
```python
|
|
335
|
-
page = meterbase.customers.list(plan="pro", limit=
|
|
336
|
-
page.data # the newest
|
|
335
|
+
page = meterbase.customers.list(plan="pro", limit=50)
|
|
336
|
+
page.data # the newest 50 customers on pro
|
|
337
337
|
page.has_more # True when another page follows the last of them
|
|
338
338
|
|
|
339
339
|
for customer in meterbase.customers.list_all(has_plan=False):
|
|
@@ -926,7 +926,7 @@ except RateLimitError as error:
|
|
|
926
926
|
| `InvalidIdempotencyKeyError` | 422 — an `InvalidRequestError`: the key was not a UUIDv7 |
|
|
927
927
|
| `TooLateError` | 422 — an `InvalidRequestError`: the key is over an hour from the engine's clock, which it carries on `server_time`. Nothing was recorded |
|
|
928
928
|
| `ReservationMismatchError` | 422 — an `InvalidRequestError`: the reservation was made for a different customer or meter |
|
|
929
|
-
| `RateLimitError` | 429
|
|
929
|
+
| `RateLimitError` | 429 — `check` or `reserve` past the workspace's fair-use rate, `code == "rate_limited"`, with `retry_after` in seconds. `reserve` retries it for you; `check` raises at once, so fail open or closed |
|
|
930
930
|
| `ServerError` | 5xx |
|
|
931
931
|
| `APIConnectionError` / `APITimeoutError` | the request never got an answer |
|
|
932
932
|
| `WebhookVerificationError` | `verify_webhook`: not a delivery Meterbase signed in the last five minutes |
|
|
@@ -301,12 +301,12 @@ identified. `None` means they hold no plan, which is a default deny — a
|
|
|
301
301
|
customer with no plan and no grant is denied.
|
|
302
302
|
|
|
303
303
|
**Lists come a page at a time.** `customers.list` answers one page, newest
|
|
304
|
-
first: `limit` customers, 100 unless you set it and at most
|
|
304
|
+
first: `limit` customers, 100 unless you set it and at most 100. `list_all`
|
|
305
305
|
follows the pages for you, fetching each one as the loop reaches it:
|
|
306
306
|
|
|
307
307
|
```python
|
|
308
|
-
page = meterbase.customers.list(plan="pro", limit=
|
|
309
|
-
page.data # the newest
|
|
308
|
+
page = meterbase.customers.list(plan="pro", limit=50)
|
|
309
|
+
page.data # the newest 50 customers on pro
|
|
310
310
|
page.has_more # True when another page follows the last of them
|
|
311
311
|
|
|
312
312
|
for customer in meterbase.customers.list_all(has_plan=False):
|
|
@@ -899,7 +899,7 @@ except RateLimitError as error:
|
|
|
899
899
|
| `InvalidIdempotencyKeyError` | 422 — an `InvalidRequestError`: the key was not a UUIDv7 |
|
|
900
900
|
| `TooLateError` | 422 — an `InvalidRequestError`: the key is over an hour from the engine's clock, which it carries on `server_time`. Nothing was recorded |
|
|
901
901
|
| `ReservationMismatchError` | 422 — an `InvalidRequestError`: the reservation was made for a different customer or meter |
|
|
902
|
-
| `RateLimitError` | 429
|
|
902
|
+
| `RateLimitError` | 429 — `check` or `reserve` past the workspace's fair-use rate, `code == "rate_limited"`, with `retry_after` in seconds. `reserve` retries it for you; `check` raises at once, so fail open or closed |
|
|
903
903
|
| `ServerError` | 5xx |
|
|
904
904
|
| `APIConnectionError` / `APITimeoutError` | the request never got an answer |
|
|
905
905
|
| `WebhookVerificationError` | `verify_webhook`: not a delivery Meterbase signed in the last five minutes |
|
|
@@ -126,6 +126,10 @@ class AsyncMeterbase:
|
|
|
126
126
|
is waiting on, and answers in milliseconds when the engine is well.
|
|
127
127
|
Decide what an `APITimeoutError` means here, failing open or closed,
|
|
128
128
|
rather than waiting out the 35 s the writes are given.
|
|
129
|
+
|
|
130
|
+
`check` and `reserve` share the workspace's fair-use rate. Past it this
|
|
131
|
+
raises `RateLimitError` with `retry_after` in seconds and is not
|
|
132
|
+
retried, for the same reason: fail open or closed as on a timeout.
|
|
129
133
|
"""
|
|
130
134
|
return await self._api.request(
|
|
131
135
|
"POST",
|
|
@@ -115,7 +115,7 @@ class AsyncCustomers:
|
|
|
115
115
|
) -> Page[Customer]:
|
|
116
116
|
"""
|
|
117
117
|
One page, newest first: `limit` customers, 100 unless set and at most
|
|
118
|
-
|
|
118
|
+
100. Pass the last `id` as `starting_after` for the next page, while
|
|
119
119
|
`has_more` is `True`; `list_all` does that for you.
|
|
120
120
|
|
|
121
121
|
`plan`, a key or an id, and `has_plan` filter on the plan in force now;
|
|
@@ -130,6 +130,10 @@ class Meterbase:
|
|
|
130
130
|
is waiting on, and answers in milliseconds when the engine is well.
|
|
131
131
|
Decide what an `APITimeoutError` means here, failing open or closed,
|
|
132
132
|
rather than waiting out the 35 s the writes are given.
|
|
133
|
+
|
|
134
|
+
`check` and `reserve` share the workspace's fair-use rate. Past it this
|
|
135
|
+
raises `RateLimitError` with `retry_after` in seconds and is not
|
|
136
|
+
retried, for the same reason: fail open or closed as on a timeout.
|
|
133
137
|
"""
|
|
134
138
|
return self._api.request(
|
|
135
139
|
"POST",
|
|
@@ -119,7 +119,7 @@ class Customers:
|
|
|
119
119
|
) -> Page[Customer]:
|
|
120
120
|
"""
|
|
121
121
|
One page, newest first: `limit` customers, 100 unless set and at most
|
|
122
|
-
|
|
122
|
+
100. Pass the last `id` as `starting_after` for the next page, while
|
|
123
123
|
`has_more` is `True`; `list_all` does that for you.
|
|
124
124
|
|
|
125
125
|
`plan`, a key or an id, and `has_plan` filter on the plan in force now;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.1"
|
|
@@ -212,8 +212,13 @@ class IdempotencyKeyReusedError(ConflictError):
|
|
|
212
212
|
|
|
213
213
|
|
|
214
214
|
class RateLimitError(APIError):
|
|
215
|
-
"""`429
|
|
216
|
-
|
|
215
|
+
"""`429 rate_limited`: `check` or `reserve` past the workspace's fair-use
|
|
216
|
+
rate, 10 a second on Free, 100 on Pro, 500 on Scale and 5 in a sandbox.
|
|
217
|
+
Nothing was checked or held. `reserve` retries it for you; `check` raises
|
|
218
|
+
at once, so fail open or closed as you would on a timeout.
|
|
219
|
+
|
|
220
|
+
A customer's rate limit is not one: `check` and `reserve` report that as
|
|
221
|
+
`allowed=False`."""
|
|
217
222
|
|
|
218
223
|
retry_after: float | None
|
|
219
224
|
"""Seconds to wait, from `Retry-After`, when the engine sends one."""
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|