sendora 2.5.0__tar.gz → 2.6.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.5.0 → sendora-2.6.0}/CHANGELOG.md +17 -0
  2. {sendora-2.5.0 → sendora-2.6.0}/PKG-INFO +21 -11
  3. {sendora-2.5.0 → sendora-2.6.0}/README.md +20 -10
  4. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_version.py +1 -1
  5. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/types.py +32 -0
  6. {sendora-2.5.0 → sendora-2.6.0}/.gitignore +0 -0
  7. {sendora-2.5.0 → sendora-2.6.0}/LICENSE +0 -0
  8. {sendora-2.5.0 → sendora-2.6.0}/pyproject.toml +0 -0
  9. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/__init__.py +0 -0
  10. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_account.py +0 -0
  11. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_answers.py +0 -0
  12. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_client.py +0 -0
  13. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_errors.py +0 -0
  14. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_json.py +0 -0
  15. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_keys.py +0 -0
  16. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_model.py +0 -0
  17. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_options.py +0 -0
  18. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_pages.py +0 -0
  19. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_retry.py +0 -0
  20. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_transport.py +0 -0
  21. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_webhooks.py +0 -0
  22. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/_wire.py +0 -0
  23. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/py.typed +0 -0
  24. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/__init__.py +0 -0
  25. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/broadcasts.py +0 -0
  26. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/domains.py +0 -0
  27. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/email.py +0 -0
  28. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/erasures.py +0 -0
  29. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/inbound.py +0 -0
  30. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/inbound_domains.py +0 -0
  31. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/messages.py +0 -0
  32. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/server.py +0 -0
  33. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/servers.py +0 -0
  34. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/streams.py +0 -0
  35. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/suppressions.py +0 -0
  36. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/tokens.py +0 -0
  37. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/tracking_domains.py +0 -0
  38. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/tracking_opt_outs.py +0 -0
  39. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/resources/webhooks.py +0 -0
  40. {sendora-2.5.0 → sendora-2.6.0}/src/sendora/skills/sendora/SKILL.md +0 -0
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.6.0
4
+
5
+ - `email.send`, each message of `email.send_batch` and `broadcasts.send` take
6
+ `track_opens` and `track_links`, which switch tracking on or off for that
7
+ mail whatever its stream's switches say.
8
+ - Each `Stream` has `track_opens` and `track_links`, its tracking switches,
9
+ which an administrator moves in the dashboard.
10
+ - Two error codes, `tracking_not_confirmed` and `tracking_unavailable`, for a
11
+ `True` before the account's first switch in the dashboard and where
12
+ tracking is not open to the account.
13
+
14
+ ## 2.5.1
15
+
16
+ - The README no longer says that tracking is not open to accounts. It says
17
+ that an administrator switches tracking on for a stream in the dashboard.
18
+ No call changes.
19
+
3
20
  ## 2.5.0
4
21
 
5
22
  - A new event, `TrackingOptedOutEvent`, for `tracking_opted_out`: a recipient
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sendora
3
- Version: 2.5.0
3
+ Version: 2.6.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
@@ -97,6 +97,12 @@ may come from another process. The API remembers a key for 24 hours and
97
97
  refuses it with a different body (`idempotency_key_mismatch`). An error
98
98
  from a send carries the key it went under as `error.idempotency_key`.
99
99
 
100
+ A message's `track_opens` and `track_links` switch tracking on or off for
101
+ that message, whatever its stream's switches say. Left out, the stream
102
+ decides. `True` raises `tracking_not_confirmed` until an administrator has
103
+ first switched tracking on in the dashboard. Where tracking is not open to
104
+ the account, it raises `tracking_unavailable`.
105
+
100
106
  A batch never raises for one refused message. Each result is an
101
107
  `AcceptedBatchItem` with the id, or a `RefusedBatchItem` with the same
102
108
  `code` a single send would raise; a retried batch answers the items sent
@@ -148,8 +154,9 @@ list of them), `from_` and `to` as an aware `datetime` or ISO 8601,
148
154
 
149
155
  Where mail is tracked, each recipient has `tracked`, `opens`, `clicks`,
150
156
  `first_open_at` and `first_human_open_at`. `messages.get` adds `tracking`, and
151
- its timeline holds `Open` and `Click` events with their labels. Tracking is
152
- not open to accounts yet.
157
+ its timeline holds `Open` and `Click` events with their labels. An
158
+ administrator switches tracking on for a stream in the dashboard. A
159
+ message's own `track_opens` and `track_links` win over the stream's.
153
160
 
154
161
  ```python
155
162
  from datetime import UTC, datetime
@@ -169,7 +176,8 @@ Every message goes on a stream of its server. A server starts with a
169
176
  default transactional stream, and the account adds more: transactional
170
177
  and broadcast ones, and one inbound stream, which receives mail at its
171
178
  `inbound_address` instead of sending. Each sending stream has a
172
- suppression list of its own.
179
+ suppression list of its own. Its `track_opens` and `track_links` show its
180
+ tracking switches, which an administrator moves in the dashboard.
173
181
 
174
182
  | Call | Answers |
175
183
  | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
@@ -203,6 +211,9 @@ message's `substitutions`, up to 20 strings, replace `{{ key }}` in the
203
211
  subject, the text and the HTML, escaped in the HTML; a key the content
204
212
  names that a message lacks raises `substitution_missing`.
205
213
 
214
+ A broadcast's `track_opens` and `track_links` apply to every message, as a
215
+ send's do.
216
+
206
217
  | Call | Answers |
207
218
  | ----------------------------------------- | ---------------------------------------------------------------------------------- |
208
219
  | `sendora.broadcasts.send(**broadcast)` | `AcceptedBroadcast` with `broadcast_id`, `total`, `suppressed` and `test` |
@@ -250,8 +261,7 @@ sendora.suppressions.delete(address="anna@example.com")
250
261
 
251
262
  Addresses the server never tracks, on any of its streams. Mail to one still
252
263
  goes out, untracked, and its opens and clicks of mail already sent are not
253
- recorded. Tracking is not open to accounts yet, so the list changes nothing
254
- until it is.
264
+ recorded.
255
265
 
256
266
  | Call | Answers |
257
267
  | ------------------------------------------------ | -------------------------------------------------------- |
@@ -351,8 +361,7 @@ sizes, the `authentication` verdicts and, for a webhook with
351
361
  `to`, `subject`, `text`, `html`, `attachments` and the rest.
352
362
  `inbound_cap_warning` and `inbound_cap_reached` say that received mail
353
363
  nears or reaches the account's monthly cap, with `cap`, `used` and the
354
- period. Every event carries `id`, the delivery id, and `attempt`. Tracking is
355
- not open to accounts yet, so `opened` and `clicked` are not sent until it is.
364
+ period. Every event carries `id`, the delivery id, and `attempt`.
356
365
 
357
366
  A failed delivery is retried with growing delays for about a day, then it
358
367
  is `dead` until you replay it. Deliveries arrive at least once and not
@@ -477,9 +486,8 @@ print(domain.dkim.type, domain.dkim.host, domain.dkim.value)
477
486
 
478
487
  A tracking domain is the host that tracked links and the open pixel use: a
479
488
  subdomain of a verified sending domain, with one CNAME record to add. CAA
480
- records above it must let Let's Encrypt issue its certificate. Tracking is
481
- not open to accounts yet, so a host carries no mail until it is. A host
482
- whose records are not right within 7 days goes.
489
+ records above it must let Let's Encrypt issue its certificate. A host whose
490
+ records are not right within 7 days goes.
483
491
 
484
492
  | Call | Answers |
485
493
  | ----------------------------------------------------- | --------------------------------------------------------------------- |
@@ -561,6 +569,8 @@ except SendoraError as error:
561
569
  | `payment_required` | 402 | The first payment has not arrived, an invoice is unpaid, payment is paused, or the subscription has ended. |
562
570
  | `account_paused` | 403 | Sendora has paused the account. |
563
571
  | `account_not_active` | 403 | The account is not approved to send, or not active for an inbound stream. |
572
+ | `tracking_unavailable` | 403 | A message asked for tracking, and tracking is not open to the account. |
573
+ | `tracking_not_confirmed` | 409 | A message asked for tracking before an administrator first switched it on in the dashboard. |
564
574
  | `spam_complaint_locked` | 403 | Only support can lift a spam-complaint suppression. |
565
575
  | `unsubscribe_locked` | 403 | Only support can lift a recipient's own unsubscribe. |
566
576
  | `not_found` | 404 | No such id on this server, or no such suppressed or not-tracked address. |
@@ -75,6 +75,12 @@ may come from another process. The API remembers a key for 24 hours and
75
75
  refuses it with a different body (`idempotency_key_mismatch`). An error
76
76
  from a send carries the key it went under as `error.idempotency_key`.
77
77
 
78
+ A message's `track_opens` and `track_links` switch tracking on or off for
79
+ that message, whatever its stream's switches say. Left out, the stream
80
+ decides. `True` raises `tracking_not_confirmed` until an administrator has
81
+ first switched tracking on in the dashboard. Where tracking is not open to
82
+ the account, it raises `tracking_unavailable`.
83
+
78
84
  A batch never raises for one refused message. Each result is an
79
85
  `AcceptedBatchItem` with the id, or a `RefusedBatchItem` with the same
80
86
  `code` a single send would raise; a retried batch answers the items sent
@@ -126,8 +132,9 @@ list of them), `from_` and `to` as an aware `datetime` or ISO 8601,
126
132
 
127
133
  Where mail is tracked, each recipient has `tracked`, `opens`, `clicks`,
128
134
  `first_open_at` and `first_human_open_at`. `messages.get` adds `tracking`, and
129
- its timeline holds `Open` and `Click` events with their labels. Tracking is
130
- not open to accounts yet.
135
+ its timeline holds `Open` and `Click` events with their labels. An
136
+ administrator switches tracking on for a stream in the dashboard. A
137
+ message's own `track_opens` and `track_links` win over the stream's.
131
138
 
132
139
  ```python
133
140
  from datetime import UTC, datetime
@@ -147,7 +154,8 @@ Every message goes on a stream of its server. A server starts with a
147
154
  default transactional stream, and the account adds more: transactional
148
155
  and broadcast ones, and one inbound stream, which receives mail at its
149
156
  `inbound_address` instead of sending. Each sending stream has a
150
- suppression list of its own.
157
+ suppression list of its own. Its `track_opens` and `track_links` show its
158
+ tracking switches, which an administrator moves in the dashboard.
151
159
 
152
160
  | Call | Answers |
153
161
  | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
@@ -181,6 +189,9 @@ message's `substitutions`, up to 20 strings, replace `{{ key }}` in the
181
189
  subject, the text and the HTML, escaped in the HTML; a key the content
182
190
  names that a message lacks raises `substitution_missing`.
183
191
 
192
+ A broadcast's `track_opens` and `track_links` apply to every message, as a
193
+ send's do.
194
+
184
195
  | Call | Answers |
185
196
  | ----------------------------------------- | ---------------------------------------------------------------------------------- |
186
197
  | `sendora.broadcasts.send(**broadcast)` | `AcceptedBroadcast` with `broadcast_id`, `total`, `suppressed` and `test` |
@@ -228,8 +239,7 @@ sendora.suppressions.delete(address="anna@example.com")
228
239
 
229
240
  Addresses the server never tracks, on any of its streams. Mail to one still
230
241
  goes out, untracked, and its opens and clicks of mail already sent are not
231
- recorded. Tracking is not open to accounts yet, so the list changes nothing
232
- until it is.
242
+ recorded.
233
243
 
234
244
  | Call | Answers |
235
245
  | ------------------------------------------------ | -------------------------------------------------------- |
@@ -329,8 +339,7 @@ sizes, the `authentication` verdicts and, for a webhook with
329
339
  `to`, `subject`, `text`, `html`, `attachments` and the rest.
330
340
  `inbound_cap_warning` and `inbound_cap_reached` say that received mail
331
341
  nears or reaches the account's monthly cap, with `cap`, `used` and the
332
- period. Every event carries `id`, the delivery id, and `attempt`. Tracking is
333
- not open to accounts yet, so `opened` and `clicked` are not sent until it is.
342
+ period. Every event carries `id`, the delivery id, and `attempt`.
334
343
 
335
344
  A failed delivery is retried with growing delays for about a day, then it
336
345
  is `dead` until you replay it. Deliveries arrive at least once and not
@@ -455,9 +464,8 @@ print(domain.dkim.type, domain.dkim.host, domain.dkim.value)
455
464
 
456
465
  A tracking domain is the host that tracked links and the open pixel use: a
457
466
  subdomain of a verified sending domain, with one CNAME record to add. CAA
458
- records above it must let Let's Encrypt issue its certificate. Tracking is
459
- not open to accounts yet, so a host carries no mail until it is. A host
460
- whose records are not right within 7 days goes.
467
+ records above it must let Let's Encrypt issue its certificate. A host whose
468
+ records are not right within 7 days goes.
461
469
 
462
470
  | Call | Answers |
463
471
  | ----------------------------------------------------- | --------------------------------------------------------------------- |
@@ -539,6 +547,8 @@ except SendoraError as error:
539
547
  | `payment_required` | 402 | The first payment has not arrived, an invoice is unpaid, payment is paused, or the subscription has ended. |
540
548
  | `account_paused` | 403 | Sendora has paused the account. |
541
549
  | `account_not_active` | 403 | The account is not approved to send, or not active for an inbound stream. |
550
+ | `tracking_unavailable` | 403 | A message asked for tracking, and tracking is not open to the account. |
551
+ | `tracking_not_confirmed` | 409 | A message asked for tracking before an administrator first switched it on in the dashboard. |
542
552
  | `spam_complaint_locked` | 403 | Only support can lift a spam-complaint suppression. |
543
553
  | `unsubscribe_locked` | 403 | Only support can lift a recipient's own unsubscribe. |
544
554
  | `not_found` | 404 | No such id on this server, or no such suppressed or not-tracked address. |
@@ -1,3 +1,3 @@
1
1
  """The package's version: the build reads it, and every request names it."""
2
2
 
3
- __version__ = "2.5.0"
3
+ __version__ = "2.6.0"
@@ -196,6 +196,8 @@ SendoraErrorCode = Literal[
196
196
  "payment_required",
197
197
  "account_paused",
198
198
  "account_not_active",
199
+ "tracking_unavailable",
200
+ "tracking_not_confirmed",
199
201
  "spam_complaint_locked",
200
202
  "unsubscribe_locked",
201
203
  "not_found",
@@ -345,6 +347,15 @@ class SendParams(TypedDict):
345
347
  and its events.
346
348
  metadata: Up to 20 pairs of your own, returned with the message
347
349
  and its events, their keys sent as given.
350
+ track_opens: Whether the message's opens are tracked, whatever
351
+ its stream's switch says; the stream decides when left out.
352
+ ``True`` raises ``tracking_not_confirmed`` until an
353
+ administrator has first switched tracking on in the dashboard,
354
+ and ``tracking_unavailable`` where tracking is not open to the
355
+ account.
356
+ track_links: Whether the message's links are tracked, whatever
357
+ its stream's switch says; the stream decides when left out.
358
+ ``True`` is refused as for ``track_opens``.
348
359
  """
349
360
 
350
361
  from_: Address
@@ -359,6 +370,8 @@ class SendParams(TypedDict):
359
370
  attachments: NotRequired[SequenceNotStr[AttachmentParams]]
360
371
  tag: NotRequired[str | None]
361
372
  metadata: NotRequired[Mapping[str, str]]
373
+ track_opens: NotRequired[bool]
374
+ track_links: NotRequired[bool]
362
375
 
363
376
 
364
377
  @model
@@ -819,6 +832,15 @@ class BroadcastParams(TypedDict):
819
832
  message.
820
833
  metadata: Up to 20 pairs of your own, on the broadcast and every
821
834
  message.
835
+ track_opens: Whether the opens of every message are tracked,
836
+ whatever the stream's switch says; the stream decides when left
837
+ out. ``True`` raises ``tracking_not_confirmed`` until an
838
+ administrator has first switched tracking on in the dashboard,
839
+ and ``tracking_unavailable`` where tracking is not open to the
840
+ account.
841
+ track_links: Whether the links of every message are tracked,
842
+ whatever the stream's switch says; the stream decides when left
843
+ out. ``True`` is refused as for ``track_opens``.
822
844
  """
823
845
 
824
846
  stream_id: str
@@ -831,6 +853,8 @@ class BroadcastParams(TypedDict):
831
853
  attachments: NotRequired[SequenceNotStr[AttachmentParams]]
832
854
  tag: NotRequired[str | None]
833
855
  metadata: NotRequired[Mapping[str, str]]
856
+ track_opens: NotRequired[bool]
857
+ track_links: NotRequired[bool]
834
858
 
835
859
 
836
860
  @model
@@ -978,6 +1002,12 @@ class Stream(Answer):
978
1002
  content_retention_days: How many days an inbound stream keeps
979
1003
  received content, 1 to 30; ``None`` for the default of 30, and
980
1004
  on every other kind.
1005
+ track_opens: Whether the opens of its mail are tracked, unless a
1006
+ message sets ``track_opens``. An administrator switches it in
1007
+ the dashboard; always ``False`` on an inbound stream.
1008
+ track_links: Whether the links in its mail are tracked, unless a
1009
+ message sets ``track_links``. An administrator switches it in
1010
+ the dashboard; always ``False`` on an inbound stream.
981
1011
  """
982
1012
 
983
1013
  stream_id: str
@@ -989,6 +1019,8 @@ class Stream(Answer):
989
1019
  paused_at: datetime | None
990
1020
  inbound_address: str | None
991
1021
  content_retention_days: int | None
1022
+ track_opens: bool
1023
+ track_links: bool
992
1024
 
993
1025
 
994
1026
  @model
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