sendora 2.7.0__tar.gz → 2.8.0__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.
Files changed (40) hide show
  1. {sendora-2.7.0 → sendora-2.8.0}/CHANGELOG.md +14 -0
  2. {sendora-2.7.0 → sendora-2.8.0}/PKG-INFO +3 -1
  3. {sendora-2.7.0 → sendora-2.8.0}/README.md +2 -0
  4. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_errors.py +4 -2
  5. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_version.py +1 -1
  6. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_webhooks.py +8 -1
  7. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/domains.py +4 -2
  8. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/webhooks.py +4 -2
  9. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/types.py +2 -0
  10. {sendora-2.7.0 → sendora-2.8.0}/.gitignore +0 -0
  11. {sendora-2.7.0 → sendora-2.8.0}/LICENSE +0 -0
  12. {sendora-2.7.0 → sendora-2.8.0}/pyproject.toml +0 -0
  13. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/__init__.py +0 -0
  14. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_account.py +0 -0
  15. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_answers.py +0 -0
  16. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_client.py +0 -0
  17. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_json.py +0 -0
  18. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_keys.py +0 -0
  19. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_model.py +0 -0
  20. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_options.py +0 -0
  21. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_pages.py +0 -0
  22. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_retry.py +0 -0
  23. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_transport.py +0 -0
  24. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/_wire.py +0 -0
  25. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/py.typed +0 -0
  26. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/__init__.py +0 -0
  27. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/broadcasts.py +0 -0
  28. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/email.py +0 -0
  29. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/erasures.py +0 -0
  30. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/inbound.py +0 -0
  31. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/inbound_domains.py +0 -0
  32. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/messages.py +0 -0
  33. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/server.py +0 -0
  34. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/servers.py +0 -0
  35. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/streams.py +0 -0
  36. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/suppressions.py +0 -0
  37. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/tokens.py +0 -0
  38. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/tracking_domains.py +0 -0
  39. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/resources/tracking_opt_outs.py +0 -0
  40. {sendora-2.7.0 → sendora-2.8.0}/src/sendora/skills/sendora/SKILL.md +0 -0
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.8.0
4
+
5
+ - Two new error codes, each a `ConflictError` with `max`.
6
+ `unverified_domain_limit` means that the account has as many unverified
7
+ domains as it may, and `webhook_limit` that the server has as many
8
+ webhooks as it may.
9
+
10
+ ## 2.7.1
11
+
12
+ - `verify_webhook` takes the same whitespace around a part of the
13
+ `Sendora-Signature` header as the other SDKs do. It takes a byte order
14
+ mark, and no longer takes U+0085 or an ASCII separator. Every header
15
+ that Sendora sends verifies as before.
16
+
3
17
  ## 2.7.0
4
18
 
5
19
  - A new error code, `daily_cap_reached`. An account can have a daily cap,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sendora
3
- Version: 2.7.0
3
+ Version: 2.8.0
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
@@ -576,6 +576,7 @@ except SendoraError as error:
576
576
  | `unsubscribe_locked` | 403 | Only support can lift a recipient's own unsubscribe. |
577
577
  | `not_found` | 404 | No such id on this server, or no such suppressed or not-tracked address. |
578
578
  | `domain_exists` | 409 | The account already has the domain; `existing_id` names it. |
579
+ | `unverified_domain_limit` | 409 | The account has as many unverified domains as it may; `max` says how many. |
579
580
  | `domain_reserved` | 400 | The name is Sendora's own; no account can receive on it. |
580
581
  | `tracking_domain_exists` | 409 | The account already has the host, or one on that sending domain; `existing_id` names it. |
581
582
  | `tracking_domain_limit` | 409 | The account has as many tracking domains as it may. |
@@ -584,6 +585,7 @@ except SendoraError as error:
584
585
  | `tracking_host_taken` | 409 | Another account holds the host. |
585
586
  | `inbound_domain_exists` | 409 | The stream already has a domain (`existing_id` names it), or another account holds the name verified. |
586
587
  | `webhook_exists` | 409 | The server already has a webhook for that URL; `existing_id` names it. |
588
+ | `webhook_limit` | 409 | The server has as many webhooks as it may; `max` says how many. |
587
589
  | `stream_exists` | 409 | The server already has a stream with that name; `existing_id` names it. |
588
590
  | `inbound_stream_exists` | 409 | The server already has a live inbound stream; `existing_id` names it. |
589
591
  | `default_stream` | 409 | The default stream cannot be archived. |
@@ -554,6 +554,7 @@ except SendoraError as error:
554
554
  | `unsubscribe_locked` | 403 | Only support can lift a recipient's own unsubscribe. |
555
555
  | `not_found` | 404 | No such id on this server, or no such suppressed or not-tracked address. |
556
556
  | `domain_exists` | 409 | The account already has the domain; `existing_id` names it. |
557
+ | `unverified_domain_limit` | 409 | The account has as many unverified domains as it may; `max` says how many. |
557
558
  | `domain_reserved` | 400 | The name is Sendora's own; no account can receive on it. |
558
559
  | `tracking_domain_exists` | 409 | The account already has the host, or one on that sending domain; `existing_id` names it. |
559
560
  | `tracking_domain_limit` | 409 | The account has as many tracking domains as it may. |
@@ -562,6 +563,7 @@ except SendoraError as error:
562
563
  | `tracking_host_taken` | 409 | Another account holds the host. |
563
564
  | `inbound_domain_exists` | 409 | The stream already has a domain (`existing_id` names it), or another account holds the name verified. |
564
565
  | `webhook_exists` | 409 | The server already has a webhook for that URL; `existing_id` names it. |
566
+ | `webhook_limit` | 409 | The server has as many webhooks as it may; `max` says how many. |
565
567
  | `stream_exists` | 409 | The server already has a stream with that name; `existing_id` names it. |
566
568
  | `inbound_stream_exists` | 409 | The server already has a live inbound stream; `existing_id` names it. |
567
569
  | `default_stream` | 409 | The default stream cannot be archived. |
@@ -43,8 +43,10 @@ class SendoraError(Exception):
43
43
  ``monthly_cap_reached``.
44
44
  resets_at: When the day's or the month's count starts again, on
45
45
  ``daily_cap_reached`` and ``monthly_cap_reached``.
46
- max: How many keys, secrets or servers may exist, on
47
- ``token_limit``, ``secret_limit`` and ``server_limit``.
46
+ max: How many keys, secrets, servers, webhooks or unverified
47
+ domains may exist, on ``token_limit``, ``secret_limit``,
48
+ ``server_limit``, ``webhook_limit`` and
49
+ ``unverified_domain_limit``.
48
50
  issues: One entry per field, on ``invalid_request``.
49
51
  suppressed: The recipients refused, on ``recipient_suppressed``.
50
52
  stream_id: The stream whose list refused them, on
@@ -1,3 +1,3 @@
1
1
  """The package's version: the build reads it, and every request names it."""
2
2
 
3
- __version__ = "2.7.0"
3
+ __version__ = "2.8.0"
@@ -39,6 +39,13 @@ DEFAULT_TOLERANCE = 300
39
39
  _SECONDS = re.compile(r"[0-9]{1,18}", re.ASCII)
40
40
  _MAC = re.compile(r"[0-9a-fA-F]{64}", re.ASCII)
41
41
 
42
+ # What ECMAScript's trim() strips, as the TypeScript SDK does. A bare
43
+ # strip() also takes U+001C to U+001F and U+0085, and keeps U+FEFF.
44
+ _WHITESPACE = (
45
+ "\t\n\v\f\r \xa0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006"
46
+ "\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff"
47
+ )
48
+
42
49
 
43
50
  def verify_webhook(
44
51
  body: bytes | str,
@@ -111,7 +118,7 @@ def _parsed(header: str | None) -> tuple[int, list[str]]:
111
118
  macs: list[str] = []
112
119
  for part in header.split(","):
113
120
  name, separator, value = part.partition("=")
114
- name, value = name.strip(), value.strip()
121
+ name, value = name.strip(_WHITESPACE), value.strip(_WHITESPACE)
115
122
  if not separator or not name:
116
123
  continue
117
124
  if name == "t":
@@ -29,7 +29,8 @@ class Domains:
29
29
 
30
30
  Raises:
31
31
  ConflictError: The account has the domain (``domain_exists``,
32
- with ``existing_id``).
32
+ with ``existing_id``), or as many unverified ones as it may
33
+ (``unverified_domain_limit``, with ``max``).
33
34
 
34
35
  Example:
35
36
  >>> added = account.domains.create(domain="example.se")
@@ -126,7 +127,8 @@ class AsyncDomains:
126
127
 
127
128
  Raises:
128
129
  ConflictError: The account has the domain (``domain_exists``,
129
- with ``existing_id``).
130
+ with ``existing_id``), or as many unverified ones as it may
131
+ (``unverified_domain_limit``, with ``max``).
130
132
 
131
133
  Example:
132
134
  >>> added = await account.domains.create(domain="example.se")
@@ -56,7 +56,8 @@ class Webhooks:
56
56
 
57
57
  Raises:
58
58
  ConflictError: The server has a webhook for the URL
59
- (``webhook_exists``, with ``existing_id``).
59
+ (``webhook_exists``, with ``existing_id``), or as many as it
60
+ may (``webhook_limit``, with ``max``).
60
61
 
61
62
  Example:
62
63
  >>> created = sendora.webhooks.create(
@@ -274,7 +275,8 @@ class AsyncWebhooks:
274
275
 
275
276
  Raises:
276
277
  ConflictError: The server has a webhook for the URL
277
- (``webhook_exists``, with ``existing_id``).
278
+ (``webhook_exists``, with ``existing_id``), or as many as it
279
+ may (``webhook_limit``, with ``max``).
278
280
 
279
281
  Example:
280
282
  >>> created = await sendora.webhooks.create(
@@ -203,6 +203,7 @@ SendoraErrorCode = Literal[
203
203
  "not_found",
204
204
  "domain_exists",
205
205
  "domain_reserved",
206
+ "unverified_domain_limit",
206
207
  "inbound_domain_exists",
207
208
  "tracking_domain_exists",
208
209
  "tracking_domain_limit",
@@ -210,6 +211,7 @@ SendoraErrorCode = Literal[
210
211
  "tracking_host_not_verified",
211
212
  "tracking_host_taken",
212
213
  "webhook_exists",
214
+ "webhook_limit",
213
215
  "stream_exists",
214
216
  "inbound_stream_exists",
215
217
  "default_stream",
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