sendora 2.8.0__tar.gz → 2.9.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.
- {sendora-2.8.0 → sendora-2.9.1}/CHANGELOG.md +13 -0
- {sendora-2.8.0 → sendora-2.9.1}/PKG-INFO +21 -19
- {sendora-2.8.0 → sendora-2.9.1}/README.md +21 -19
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_version.py +1 -1
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/servers.py +4 -4
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/tokens.py +34 -38
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/skills/sendora/SKILL.md +7 -3
- {sendora-2.8.0 → sendora-2.9.1}/.gitignore +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/LICENSE +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/pyproject.toml +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/__init__.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_account.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_answers.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_client.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_errors.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_json.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_keys.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_model.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_options.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_pages.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_retry.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_transport.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_webhooks.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/_wire.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/py.typed +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/__init__.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/broadcasts.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/domains.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/email.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/erasures.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/inbound.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/inbound_domains.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/messages.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/server.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/streams.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/suppressions.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/tracking_domains.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/tracking_opt_outs.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/resources/webhooks.py +0 -0
- {sendora-2.8.0 → sendora-2.9.1}/src/sendora/types.py +0 -0
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.9.1
|
|
4
|
+
|
|
5
|
+
- The README, the skill and the docstrings say that a server holds up to
|
|
6
|
+
ten live keys, so each system can have its own. The account still holds
|
|
7
|
+
up to two. No call changes.
|
|
8
|
+
|
|
9
|
+
## 2.9.0
|
|
10
|
+
|
|
11
|
+
- `tokens.create` and `tokens.revoke` of `Sendora` and `AsyncSendora` are
|
|
12
|
+
deprecated, since no server key creates or revokes a key any more. The API
|
|
13
|
+
refuses both with `wrong_token_kind`, whatever the package's version. Use
|
|
14
|
+
`servers.tokens` of `SendoraAccount`, or the dashboard.
|
|
15
|
+
|
|
3
16
|
## 2.8.0
|
|
4
17
|
|
|
5
18
|
- Two new error codes, each a `ConflictError` with `max`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sendora
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.1
|
|
4
4
|
Summary: The Python client for Sendora's email API.
|
|
5
5
|
Project-URL: Homepage, https://sendora.se/docs
|
|
6
6
|
License-Expression: MIT
|
|
@@ -287,20 +287,19 @@ sendora.tracking_opt_outs.add(address="anna@example.com")
|
|
|
287
287
|
|
|
288
288
|
## Tokens
|
|
289
289
|
|
|
290
|
-
The server's own keys,
|
|
291
|
-
same rights
|
|
292
|
-
|
|
293
|
-
manages the same keys under `account.servers.tokens`.
|
|
290
|
+
The server's own keys, read with any of them. Every key of a server has the
|
|
291
|
+
same rights. The account key creates and revokes them, under
|
|
292
|
+
`account.servers.tokens`. So does a person, in the dashboard.
|
|
294
293
|
|
|
295
|
-
| Call
|
|
296
|
-
|
|
|
297
|
-
| `sendora.tokens.
|
|
298
|
-
| `sendora.tokens.
|
|
299
|
-
| `sendora.tokens.get(token_id)` | One token, without its value |
|
|
300
|
-
| `sendora.tokens.revoke(token_id)` | `None`; the last live key is refused (`last_token`) |
|
|
294
|
+
| Call | Answers |
|
|
295
|
+
| ------------------------------ | ------------------------------------------------ |
|
|
296
|
+
| `sendora.tokens.list()` | `TokenList` with `tokens`, revoked ones included |
|
|
297
|
+
| `sendora.tokens.get(token_id)` | One token, without its value |
|
|
301
298
|
|
|
302
|
-
|
|
303
|
-
|
|
299
|
+
`sendora.tokens.create(name=)` and `sendora.tokens.revoke(token_id)` are
|
|
300
|
+
deprecated, and go in the next major version. The API refuses both with
|
|
301
|
+
`wrong_token_kind`. A stolen server key can then neither make another key nor
|
|
302
|
+
revoke its owner's.
|
|
304
303
|
|
|
305
304
|
## The server
|
|
306
305
|
|
|
@@ -449,9 +448,9 @@ sendora = Sendora(server.token.token)
|
|
|
449
448
|
```
|
|
450
449
|
|
|
451
450
|
A server is created with its default transactional stream and its first
|
|
452
|
-
key, whose value is in the answer this once. A server holds up to
|
|
453
|
-
live keys
|
|
454
|
-
switch to it, revoke the old one.
|
|
451
|
+
key, whose value is in the answer this once. A server holds up to ten
|
|
452
|
+
live keys, so each system can have its own, and never falls below one.
|
|
453
|
+
Rotation is create the new key, switch to it, revoke the old one.
|
|
455
454
|
|
|
456
455
|
| Call | Answers |
|
|
457
456
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
@@ -460,11 +459,14 @@ switch to it, revoke the old one.
|
|
|
460
459
|
| `account.servers.get(server_id)` | One server |
|
|
461
460
|
| `account.servers.update(server_id, name=)` | The renamed server |
|
|
462
461
|
| `account.servers.delete(server_id)` | `None`; `server_in_flight` while its messages are still being delivered |
|
|
463
|
-
| `account.servers.tokens.create(server_id, name=)` | `CreatedToken` with its `token` value, once;
|
|
462
|
+
| `account.servers.tokens.create(server_id, name=)` | `CreatedToken` with its `token` value, once; an eleventh live key is `token_limit` |
|
|
464
463
|
| `account.servers.tokens.list(server_id)` | `TokenList` with `tokens`, revoked ones included |
|
|
465
464
|
| `account.servers.tokens.get(server_id, token_id)` | One key, without its value |
|
|
466
465
|
| `account.servers.tokens.revoke(server_id, token_id)` | `None`; the last live key is refused (`last_token`) |
|
|
467
466
|
|
|
467
|
+
A key's value is kept out of the answer's `repr`, so a logged answer does
|
|
468
|
+
not print it; read it from `.token`.
|
|
469
|
+
|
|
468
470
|
Sending domains belong to the account, and every server sends from them.
|
|
469
471
|
A domain sends once both DNS records are seen. A lookup that fails at the
|
|
470
472
|
resolver (`dns_error`) changes nothing, and a verified domain whose record
|
|
@@ -592,7 +594,7 @@ except SendoraError as error:
|
|
|
592
594
|
| `last_token` | 409 | The only live key cannot be revoked. |
|
|
593
595
|
| `last_secret` | 409 | The only live secret of a webhook cannot be deleted. |
|
|
594
596
|
| `secret_limit` | 409 | The webhook already holds two live secrets; `max` says how many. |
|
|
595
|
-
| `token_limit` | 409 | The server
|
|
597
|
+
| `token_limit` | 409 | The server already holds ten live keys; `max` says how many. |
|
|
596
598
|
| `server_exists` | 409 | The account already has a server with that name. |
|
|
597
599
|
| `server_limit` | 409 | The account has as many servers as it may; `max` says how many. |
|
|
598
600
|
| `server_reserved` | 409 | The server sends Sendora's own sign-in mail and cannot be renamed or removed. |
|
|
@@ -649,7 +651,7 @@ Lost connections, timeouts, `rate_limited` (the edge's own included),
|
|
|
649
651
|
twice by default, honouring `retry_after` when it fits within five
|
|
650
652
|
seconds of waiting in all. A longer `retry_after` is raised at once for
|
|
651
653
|
you to schedule. A call that creates something (`streams.create`,
|
|
652
|
-
`
|
|
654
|
+
`webhooks.create`, `webhooks.create_secret`,
|
|
653
655
|
`webhooks.replay`, `inbound_domains.create`, `servers.create`,
|
|
654
656
|
`servers.tokens.create`, `domains.create`, `tracking_domains.create`) is repeated only after a
|
|
655
657
|
`rate_limited` or `sending_disabled` answer, never after a lost connection
|
|
@@ -265,20 +265,19 @@ sendora.tracking_opt_outs.add(address="anna@example.com")
|
|
|
265
265
|
|
|
266
266
|
## Tokens
|
|
267
267
|
|
|
268
|
-
The server's own keys,
|
|
269
|
-
same rights
|
|
270
|
-
|
|
271
|
-
manages the same keys under `account.servers.tokens`.
|
|
272
|
-
|
|
273
|
-
| Call | Answers |
|
|
274
|
-
| --------------------------------- | --------------------------------------------------- |
|
|
275
|
-
| `sendora.tokens.create(name=)` | `CreatedToken` with its `token` value, once |
|
|
276
|
-
| `sendora.tokens.list()` | `TokenList` with `tokens`, revoked ones included |
|
|
277
|
-
| `sendora.tokens.get(token_id)` | One token, without its value |
|
|
278
|
-
| `sendora.tokens.revoke(token_id)` | `None`; the last live key is refused (`last_token`) |
|
|
268
|
+
The server's own keys, read with any of them. Every key of a server has the
|
|
269
|
+
same rights. The account key creates and revokes them, under
|
|
270
|
+
`account.servers.tokens`. So does a person, in the dashboard.
|
|
279
271
|
|
|
280
|
-
|
|
281
|
-
|
|
272
|
+
| Call | Answers |
|
|
273
|
+
| ------------------------------ | ------------------------------------------------ |
|
|
274
|
+
| `sendora.tokens.list()` | `TokenList` with `tokens`, revoked ones included |
|
|
275
|
+
| `sendora.tokens.get(token_id)` | One token, without its value |
|
|
276
|
+
|
|
277
|
+
`sendora.tokens.create(name=)` and `sendora.tokens.revoke(token_id)` are
|
|
278
|
+
deprecated, and go in the next major version. The API refuses both with
|
|
279
|
+
`wrong_token_kind`. A stolen server key can then neither make another key nor
|
|
280
|
+
revoke its owner's.
|
|
282
281
|
|
|
283
282
|
## The server
|
|
284
283
|
|
|
@@ -427,9 +426,9 @@ sendora = Sendora(server.token.token)
|
|
|
427
426
|
```
|
|
428
427
|
|
|
429
428
|
A server is created with its default transactional stream and its first
|
|
430
|
-
key, whose value is in the answer this once. A server holds up to
|
|
431
|
-
live keys
|
|
432
|
-
switch to it, revoke the old one.
|
|
429
|
+
key, whose value is in the answer this once. A server holds up to ten
|
|
430
|
+
live keys, so each system can have its own, and never falls below one.
|
|
431
|
+
Rotation is create the new key, switch to it, revoke the old one.
|
|
433
432
|
|
|
434
433
|
| Call | Answers |
|
|
435
434
|
| ---------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
@@ -438,11 +437,14 @@ switch to it, revoke the old one.
|
|
|
438
437
|
| `account.servers.get(server_id)` | One server |
|
|
439
438
|
| `account.servers.update(server_id, name=)` | The renamed server |
|
|
440
439
|
| `account.servers.delete(server_id)` | `None`; `server_in_flight` while its messages are still being delivered |
|
|
441
|
-
| `account.servers.tokens.create(server_id, name=)` | `CreatedToken` with its `token` value, once;
|
|
440
|
+
| `account.servers.tokens.create(server_id, name=)` | `CreatedToken` with its `token` value, once; an eleventh live key is `token_limit` |
|
|
442
441
|
| `account.servers.tokens.list(server_id)` | `TokenList` with `tokens`, revoked ones included |
|
|
443
442
|
| `account.servers.tokens.get(server_id, token_id)` | One key, without its value |
|
|
444
443
|
| `account.servers.tokens.revoke(server_id, token_id)` | `None`; the last live key is refused (`last_token`) |
|
|
445
444
|
|
|
445
|
+
A key's value is kept out of the answer's `repr`, so a logged answer does
|
|
446
|
+
not print it; read it from `.token`.
|
|
447
|
+
|
|
446
448
|
Sending domains belong to the account, and every server sends from them.
|
|
447
449
|
A domain sends once both DNS records are seen. A lookup that fails at the
|
|
448
450
|
resolver (`dns_error`) changes nothing, and a verified domain whose record
|
|
@@ -570,7 +572,7 @@ except SendoraError as error:
|
|
|
570
572
|
| `last_token` | 409 | The only live key cannot be revoked. |
|
|
571
573
|
| `last_secret` | 409 | The only live secret of a webhook cannot be deleted. |
|
|
572
574
|
| `secret_limit` | 409 | The webhook already holds two live secrets; `max` says how many. |
|
|
573
|
-
| `token_limit` | 409 | The server
|
|
575
|
+
| `token_limit` | 409 | The server already holds ten live keys; `max` says how many. |
|
|
574
576
|
| `server_exists` | 409 | The account already has a server with that name. |
|
|
575
577
|
| `server_limit` | 409 | The account has as many servers as it may; `max` says how many. |
|
|
576
578
|
| `server_reserved` | 409 | The server sends Sendora's own sign-in mail and cannot be renamed or removed. |
|
|
@@ -627,7 +629,7 @@ Lost connections, timeouts, `rate_limited` (the edge's own included),
|
|
|
627
629
|
twice by default, honouring `retry_after` when it fits within five
|
|
628
630
|
seconds of waiting in all. A longer `retry_after` is raised at once for
|
|
629
631
|
you to schedule. A call that creates something (`streams.create`,
|
|
630
|
-
`
|
|
632
|
+
`webhooks.create`, `webhooks.create_secret`,
|
|
631
633
|
`webhooks.replay`, `inbound_domains.create`, `servers.create`,
|
|
632
634
|
`servers.tokens.create`, `domains.create`, `tracking_domains.create`) is repeated only after a
|
|
633
635
|
`rate_limited` or `sending_disabled` answer, never after a lost connection
|
|
@@ -17,7 +17,7 @@ from sendora.types import (
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class ServerTokens:
|
|
20
|
-
"""The keys of one server; a server holds at most
|
|
20
|
+
"""The keys of one server; a server holds at most ten live keys."""
|
|
21
21
|
|
|
22
22
|
def __init__(self, transport: SyncTransport) -> None:
|
|
23
23
|
"""Takes the client's transport."""
|
|
@@ -37,7 +37,7 @@ class ServerTokens:
|
|
|
37
37
|
The key, with its value in ``token``.
|
|
38
38
|
|
|
39
39
|
Raises:
|
|
40
|
-
ConflictError: The server holds
|
|
40
|
+
ConflictError: The server holds ten live keys (``token_limit``).
|
|
41
41
|
|
|
42
42
|
Example:
|
|
43
43
|
>>> created = account.servers.tokens.create(server_id, name="CI")
|
|
@@ -201,7 +201,7 @@ class Servers:
|
|
|
201
201
|
|
|
202
202
|
|
|
203
203
|
class AsyncServerTokens:
|
|
204
|
-
"""The keys of one server; a server holds at most
|
|
204
|
+
"""The keys of one server; a server holds at most ten live keys."""
|
|
205
205
|
|
|
206
206
|
def __init__(self, transport: AsyncTransport) -> None:
|
|
207
207
|
"""Takes the client's transport."""
|
|
@@ -221,7 +221,7 @@ class AsyncServerTokens:
|
|
|
221
221
|
The key, with its value in ``token``.
|
|
222
222
|
|
|
223
223
|
Raises:
|
|
224
|
-
ConflictError: The server holds
|
|
224
|
+
ConflictError: The server holds ten live keys (``token_limit``).
|
|
225
225
|
|
|
226
226
|
Example:
|
|
227
227
|
>>> created = await account.servers.tokens.create(server_id, name="CI")
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""The keys of the key's own server; every key of a server has the same rights."""
|
|
2
2
|
|
|
3
|
+
import warnings
|
|
3
4
|
from urllib.parse import quote
|
|
4
5
|
|
|
5
6
|
from sendora._transport import AsyncTransport, Call, SyncTransport
|
|
@@ -8,32 +9,28 @@ from sendora.types import CreatedToken, Token, TokenList
|
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class Tokens:
|
|
11
|
-
"""
|
|
12
|
+
"""Reads the server's keys."""
|
|
12
13
|
|
|
13
14
|
def __init__(self, transport: SyncTransport) -> None:
|
|
14
15
|
"""Takes the client's transport."""
|
|
15
16
|
self._transport = transport
|
|
16
17
|
|
|
17
18
|
def create(self, *, name: str) -> CreatedToken:
|
|
18
|
-
"""
|
|
19
|
+
"""Deprecated: the API refuses it, so a stolen key makes no other.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
may have created the key.
|
|
21
|
+
Create a key with ``servers.tokens.create`` of ``SendoraAccount``, or in
|
|
22
|
+
the dashboard. The next major version does not have this method.
|
|
23
23
|
|
|
24
24
|
Args:
|
|
25
25
|
name: 1 to 100 characters, for people to tell keys apart.
|
|
26
26
|
|
|
27
27
|
Returns:
|
|
28
|
-
|
|
28
|
+
Nothing: the API refuses every call.
|
|
29
29
|
|
|
30
30
|
Raises:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Example:
|
|
34
|
-
>>> created = sendora.tokens.create(name="Fakturasystemet")
|
|
35
|
-
>>> store_secret(created.token)
|
|
31
|
+
PermissionDeniedError: Always (``wrong_token_kind``).
|
|
36
32
|
"""
|
|
33
|
+
warnings.warn(_CREATE_DEPRECATED, DeprecationWarning, stacklevel=2)
|
|
37
34
|
return decode(CreatedToken, self._transport.send(_create_call(name)))
|
|
38
35
|
|
|
39
36
|
def list(self) -> TokenList:
|
|
@@ -66,51 +63,44 @@ class Tokens:
|
|
|
66
63
|
return decode(Token, self._transport.send(_get_call(token_id)))
|
|
67
64
|
|
|
68
65
|
def revoke(self, token_id: str) -> None:
|
|
69
|
-
"""
|
|
66
|
+
"""Deprecated: the API refuses it, so a stolen key locks nobody out.
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
attempt took effect raises ``not_found``.
|
|
68
|
+
Revoke a key with ``servers.tokens.revoke`` of ``SendoraAccount``, or in
|
|
69
|
+
the dashboard. The next major version does not have this method.
|
|
74
70
|
|
|
75
71
|
Args:
|
|
76
72
|
token_id: The key's id.
|
|
77
73
|
|
|
78
74
|
Raises:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Example:
|
|
82
|
-
>>> sendora.tokens.revoke(token_id)
|
|
75
|
+
PermissionDeniedError: Always (``wrong_token_kind``).
|
|
83
76
|
"""
|
|
77
|
+
warnings.warn(_REVOKE_DEPRECATED, DeprecationWarning, stacklevel=2)
|
|
84
78
|
self._transport.send(_revoke_call(token_id))
|
|
85
79
|
|
|
86
80
|
|
|
87
81
|
class AsyncTokens:
|
|
88
|
-
"""
|
|
82
|
+
"""Reads the server's keys."""
|
|
89
83
|
|
|
90
84
|
def __init__(self, transport: AsyncTransport) -> None:
|
|
91
85
|
"""Takes the client's transport."""
|
|
92
86
|
self._transport = transport
|
|
93
87
|
|
|
94
88
|
async def create(self, *, name: str) -> CreatedToken:
|
|
95
|
-
"""
|
|
89
|
+
"""Deprecated: the API refuses it, so a stolen key makes no other.
|
|
96
90
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
may have created the key.
|
|
91
|
+
Create a key with ``servers.tokens.create`` of ``SendoraAccount``, or in
|
|
92
|
+
the dashboard. The next major version does not have this method.
|
|
100
93
|
|
|
101
94
|
Args:
|
|
102
95
|
name: 1 to 100 characters, for people to tell keys apart.
|
|
103
96
|
|
|
104
97
|
Returns:
|
|
105
|
-
|
|
98
|
+
Nothing: the API refuses every call.
|
|
106
99
|
|
|
107
100
|
Raises:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Example:
|
|
111
|
-
>>> created = await sendora.tokens.create(name="Fakturasystemet")
|
|
112
|
-
>>> store_secret(created.token)
|
|
101
|
+
PermissionDeniedError: Always (``wrong_token_kind``).
|
|
113
102
|
"""
|
|
103
|
+
warnings.warn(_CREATE_DEPRECATED, DeprecationWarning, stacklevel=2)
|
|
114
104
|
return decode(CreatedToken, await self._transport.send(_create_call(name)))
|
|
115
105
|
|
|
116
106
|
async def list(self) -> TokenList:
|
|
@@ -143,24 +133,30 @@ class AsyncTokens:
|
|
|
143
133
|
return decode(Token, await self._transport.send(_get_call(token_id)))
|
|
144
134
|
|
|
145
135
|
async def revoke(self, token_id: str) -> None:
|
|
146
|
-
"""
|
|
136
|
+
"""Deprecated: the API refuses it, so a stolen key locks nobody out.
|
|
147
137
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
attempt took effect raises ``not_found``.
|
|
138
|
+
Revoke a key with ``servers.tokens.revoke`` of ``SendoraAccount``, or in
|
|
139
|
+
the dashboard. The next major version does not have this method.
|
|
151
140
|
|
|
152
141
|
Args:
|
|
153
142
|
token_id: The key's id.
|
|
154
143
|
|
|
155
144
|
Raises:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
Example:
|
|
159
|
-
>>> await sendora.tokens.revoke(token_id)
|
|
145
|
+
PermissionDeniedError: Always (``wrong_token_kind``).
|
|
160
146
|
"""
|
|
147
|
+
warnings.warn(_REVOKE_DEPRECATED, DeprecationWarning, stacklevel=2)
|
|
161
148
|
await self._transport.send(_revoke_call(token_id))
|
|
162
149
|
|
|
163
150
|
|
|
151
|
+
_CREATE_DEPRECATED = (
|
|
152
|
+
"tokens.create is deprecated: the API refuses it. Create a key with "
|
|
153
|
+
"SendoraAccount's servers.tokens.create, or in the dashboard."
|
|
154
|
+
)
|
|
155
|
+
_REVOKE_DEPRECATED = (
|
|
156
|
+
"tokens.revoke is deprecated: the API refuses it. Revoke a key with "
|
|
157
|
+
"SendoraAccount's servers.tokens.revoke, or in the dashboard."
|
|
158
|
+
)
|
|
159
|
+
|
|
164
160
|
_LIST = Call("GET", "/v1/tokens", idempotent=True)
|
|
165
161
|
|
|
166
162
|
|
|
@@ -28,9 +28,13 @@ and every event is in it.
|
|
|
28
28
|
it.
|
|
29
29
|
- A server is created with its first key:
|
|
30
30
|
`account.servers.create(name=...)` answers `token.token` once, and
|
|
31
|
-
`Sendora(token)` sends with it. A server
|
|
32
|
-
|
|
33
|
-
revoking the old one; the last live
|
|
31
|
+
`Sendora(token)` sends with it. A server holds at most ten live keys,
|
|
32
|
+
so each system can have its own, and the account two. Rotate by creating
|
|
33
|
+
the new key, switching to it, then revoking the old one; the last live
|
|
34
|
+
key can never be revoked. The account key creates and revokes a
|
|
35
|
+
server's keys (`account.servers.tokens`). A server key only reads them
|
|
36
|
+
(`sendora.tokens.list()` and `.get()`); its `tokens.create` and
|
|
37
|
+
`tokens.revoke` are deprecated and refused (`wrong_token_kind`).
|
|
34
38
|
- For tests and CI, use a test server:
|
|
35
39
|
`account.servers.create(name=..., mode="test")`. It accepts, logs and
|
|
36
40
|
fires webhooks like a live one but delivers nothing; its keys start
|
|
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
|
|
File without changes
|