mailcycle 0.4.0__tar.gz → 0.4.2__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 (37) hide show
  1. {mailcycle-0.4.0 → mailcycle-0.4.2}/PKG-INFO +4 -4
  2. {mailcycle-0.4.0 → mailcycle-0.4.2}/README.md +3 -3
  3. {mailcycle-0.4.0 → mailcycle-0.4.2}/live/README.md +1 -1
  4. {mailcycle-0.4.0 → mailcycle-0.4.2}/pyproject.toml +4 -1
  5. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/__init__.py +1 -2
  6. mailcycle-0.4.2/src/mailcycle/_version.py +2 -0
  7. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/client.py +4 -4
  8. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/http.py +2 -1
  9. {mailcycle-0.4.0 → mailcycle-0.4.2}/tests/test_events.py +4 -4
  10. {mailcycle-0.4.0 → mailcycle-0.4.2}/.gitignore +0 -0
  11. {mailcycle-0.4.0 → mailcycle-0.4.2}/LICENSE +0 -0
  12. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/_encoding.py +0 -0
  13. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/crypto/__init__.py +0 -0
  14. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/crypto/asymmetric.py +0 -0
  15. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/crypto/authproof.py +0 -0
  16. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/crypto/cipher.py +0 -0
  17. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/crypto/identity.py +0 -0
  18. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/crypto/mnemonic.py +0 -0
  19. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/crypto/primitives.py +0 -0
  20. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/crypto/sealedbox.py +0 -0
  21. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/crypto/wordlist.py +0 -0
  22. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/errors.py +0 -0
  23. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/events.py +0 -0
  24. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/keys.py +0 -0
  25. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/mail.py +0 -0
  26. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/models.py +0 -0
  27. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/pairing.py +0 -0
  28. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/py.typed +0 -0
  29. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/trackers.py +0 -0
  30. {mailcycle-0.4.0 → mailcycle-0.4.2}/src/mailcycle/webhooks.py +0 -0
  31. {mailcycle-0.4.0 → mailcycle-0.4.2}/tests/conftest.py +0 -0
  32. {mailcycle-0.4.0 → mailcycle-0.4.2}/tests/test_client.py +0 -0
  33. {mailcycle-0.4.0 → mailcycle-0.4.2}/tests/test_cross_implementation.py +0 -0
  34. {mailcycle-0.4.0 → mailcycle-0.4.2}/tests/test_pairing.py +0 -0
  35. {mailcycle-0.4.0 → mailcycle-0.4.2}/tests/test_pairing_reference.py +0 -0
  36. {mailcycle-0.4.0 → mailcycle-0.4.2}/tests/test_trackers.py +0 -0
  37. {mailcycle-0.4.0 → mailcycle-0.4.2}/tests/test_vectors.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mailcycle
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: Python client for the Mailcycle API. Create addresses that receive mail, read and decrypt it on your machine, send, and listen for events.
5
5
  Project-URL: Homepage, https://mailcycle.email/
6
6
  Project-URL: Documentation, https://docs.mailcycle.email/
@@ -130,7 +130,7 @@ A message that will not open, because there is no phrase or it is the wrong one,
130
130
  code = mc.messages.wait_for(address_id=address.id, subject="verification", timeout=60)
131
131
  ```
132
132
 
133
- This listens on the event stream and returns the next matching message, opened. Where the stream is not available (an API key below Scale, or no `websockets` installed) it checks the address every five seconds instead, so `address_id` is needed then. If nothing arrives in time it raises an `APIError` with `code="timeout"`. Mail received from `since` on counts, even if it landed before the stream was up; it defaults to now, so to wait for a reply to something you are about to send, take the time before sending.
133
+ This listens on the event stream and returns the next matching message, opened. Where the stream is not available (no `websockets` installed) it checks the address every five seconds instead, so `address_id` is needed then. If nothing arrives in time it raises an `APIError` with `code="timeout"`. Mail received from `since` on counts, even if it landed before the stream was up; it defaults to now, so to wait for a reply to something you are about to send, take the time before sending.
134
134
 
135
135
  ## Sending
136
136
 
@@ -171,7 +171,7 @@ mc.messages.send(
171
171
  )
172
172
  ```
173
173
 
174
- A session can send on every plan; an API key on Scale and up. Limits are in the [rate limits](https://docs.mailcycle.email/reference/rate-limits/).
174
+ A session can send from Personal up; an API key on Scale and up. Free receives only. Limits are in the [rate limits](https://docs.mailcycle.email/reference/rate-limits/).
175
175
 
176
176
  `result.sent_copy_id` is `None` when the address keeps no Sent copy.
177
177
 
@@ -203,7 +203,7 @@ for delivery in mc.webhooks.deliveries(created.webhook.id):
203
203
  print(delivery.event_type, delivery.status, delivery.response_status)
204
204
  ```
205
205
 
206
- Scale and up. `webhooks.list()` returns the webhooks and `event_types`, every type one can ask for; pass `["*"]` for all of them. `update()` changes only what you pass, and `enabled` switches one off or back on. `redeliver(id, delivery_id)` sends an event again with the same event id. The name is sealed like an API key's; the URL cannot be, because the server calls it. Adding, changing, rotating and deleting need a session; an API key can list, test, read deliveries and redeliver.
206
+ Operator and up. `webhooks.list()` returns the webhooks and `event_types`, every type one can ask for; pass `["*"]` for all of them. `update()` changes only what you pass, and `enabled` switches one off or back on. `redeliver(id, delivery_id)` sends an event again with the same event id. The name is sealed like an API key's; the URL cannot be, because the server calls it. Adding, changing, rotating and deleting need a session; an API key can list, test, read deliveries and redeliver.
207
207
 
208
208
  ## Pairing devices
209
209
 
@@ -68,7 +68,7 @@ A message that will not open, because there is no phrase or it is the wrong one,
68
68
  code = mc.messages.wait_for(address_id=address.id, subject="verification", timeout=60)
69
69
  ```
70
70
 
71
- This listens on the event stream and returns the next matching message, opened. Where the stream is not available (an API key below Scale, or no `websockets` installed) it checks the address every five seconds instead, so `address_id` is needed then. If nothing arrives in time it raises an `APIError` with `code="timeout"`. Mail received from `since` on counts, even if it landed before the stream was up; it defaults to now, so to wait for a reply to something you are about to send, take the time before sending.
71
+ This listens on the event stream and returns the next matching message, opened. Where the stream is not available (no `websockets` installed) it checks the address every five seconds instead, so `address_id` is needed then. If nothing arrives in time it raises an `APIError` with `code="timeout"`. Mail received from `since` on counts, even if it landed before the stream was up; it defaults to now, so to wait for a reply to something you are about to send, take the time before sending.
72
72
 
73
73
  ## Sending
74
74
 
@@ -109,7 +109,7 @@ mc.messages.send(
109
109
  )
110
110
  ```
111
111
 
112
- A session can send on every plan; an API key on Scale and up. Limits are in the [rate limits](https://docs.mailcycle.email/reference/rate-limits/).
112
+ A session can send from Personal up; an API key on Scale and up. Free receives only. Limits are in the [rate limits](https://docs.mailcycle.email/reference/rate-limits/).
113
113
 
114
114
  `result.sent_copy_id` is `None` when the address keeps no Sent copy.
115
115
 
@@ -141,7 +141,7 @@ for delivery in mc.webhooks.deliveries(created.webhook.id):
141
141
  print(delivery.event_type, delivery.status, delivery.response_status)
142
142
  ```
143
143
 
144
- Scale and up. `webhooks.list()` returns the webhooks and `event_types`, every type one can ask for; pass `["*"]` for all of them. `update()` changes only what you pass, and `enabled` switches one off or back on. `redeliver(id, delivery_id)` sends an event again with the same event id. The name is sealed like an API key's; the URL cannot be, because the server calls it. Adding, changing, rotating and deleting need a session; an API key can list, test, read deliveries and redeliver.
144
+ Operator and up. `webhooks.list()` returns the webhooks and `event_types`, every type one can ask for; pass `["*"]` for all of them. `update()` changes only what you pass, and `enabled` switches one off or back on. `redeliver(id, delivery_id)` sends an event again with the same event id. The name is sealed like an API key's; the URL cannot be, because the server calls it. Adding, changing, rotating and deleting need a session; an API key can list, test, read deliveries and redeliver.
145
145
 
146
146
  ## Pairing devices
147
147
 
@@ -32,6 +32,6 @@ Each check prints one `PASS` or `FAIL` line, and the script exits non-zero if an
32
32
 
33
33
  ## What it does not check
34
34
 
35
- An API key below Scale being closed with 4003 on the event stream. That needs the plan changed down mid-run, which the script does not do. Check it by hand: with a key open on the stream, move the account to Operator in the console and watch the stream end.
35
+ An API key being closed with 4003 on the event stream when the plan drops below Operator. That needs the plan changed down mid-run, which the script does not do. Check it by hand: with a key open on the stream, move the account to Personal in the console and watch the stream end.
36
36
 
37
37
  Some calls here have no SDK method yet (making an API key, the refusals in step 9, deleting the account), so the script makes them through the client's own HTTP layer.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "mailcycle"
7
- version = "0.4.0"
7
+ dynamic = ["version"]
8
8
  description = "Python client for the Mailcycle API. Create addresses that receive mail, read and decrypt it on your machine, send, and listen for events."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -36,6 +36,9 @@ events = ["websockets>=13"]
36
36
  Homepage = "https://mailcycle.email/"
37
37
  Documentation = "https://docs.mailcycle.email/"
38
38
 
39
+ [tool.hatch.version]
40
+ path = "src/mailcycle/_version.py"
41
+
39
42
  [tool.hatch.build.targets.wheel]
40
43
  packages = ["src/mailcycle"]
41
44
 
@@ -19,6 +19,7 @@ Documentation: https://docs.mailcycle.email/
19
19
 
20
20
  from __future__ import annotations
21
21
 
22
+ from ._version import __version__
22
23
  from .client import Mailcycle
23
24
  from .crypto.mnemonic import generate_phrase, validate_phrase
24
25
  from .errors import (
@@ -60,8 +61,6 @@ from .models import (
60
61
  from .trackers import BlockedTracker, strip_remote_content, summarize_blocked
61
62
  from .webhooks import verify_webhook_signature, webhook_signature_header
62
63
 
63
- __version__ = "0.4.0"
64
-
65
64
  __all__ = [
66
65
  "Mailcycle",
67
66
  "Keys",
@@ -0,0 +1,2 @@
1
+ # The one place the version is written. pyproject.toml reads it from here.
2
+ __version__ = "0.4.2"
@@ -620,8 +620,8 @@ class _Messages:
620
620
  """The next message that arrives and matches, opened.
621
621
 
622
622
  Listens on the event stream where it is available, and polls
623
- `address_id` otherwise: an API key below Scale cannot open the stream,
624
- and neither can a client without `websockets` installed. Raises an
623
+ `address_id` otherwise: a client without `websockets` installed cannot
624
+ open the stream. Raises an
625
625
  `APIError` with ``code="timeout"`` if nothing matching arrives in time.
626
626
 
627
627
  Mail received from `since` on counts, including mail that arrived
@@ -921,7 +921,7 @@ class _Events:
921
921
  ) -> EventStream:
922
922
  """Every account event as it happens.
923
923
 
924
- Sessions on any plan; API keys on Scale and up. Iterate the result, or
924
+ Sessions on any plan; API keys on Operator and up. Iterate the result, or
925
925
  pass `on_event` to be called on the stream's own thread.
926
926
  """
927
927
  token = self._client._http.token
@@ -974,7 +974,7 @@ class _ApiKeys:
974
974
 
975
975
 
976
976
  class _Webhooks:
977
- """Webhook endpoints, Scale and up.
977
+ """Webhook endpoints, Operator and up.
978
978
 
979
979
  Adding, changing, rotating and removing one needs a signed-in session. An
980
980
  API key can list them, read deliveries, send a test and redeliver.
@@ -10,6 +10,7 @@ from urllib.parse import quote
10
10
 
11
11
  import httpx
12
12
 
13
+ from ._version import __version__
13
14
  from .errors import APIError
14
15
 
15
16
  DEFAULT_API_URL = "https://api.mailcycle.email"
@@ -34,7 +35,7 @@ class Http:
34
35
  *,
35
36
  client: httpx.Client | None = None,
36
37
  timeout: float = DEFAULT_TIMEOUT,
37
- user_agent: str = "mailcycle-python",
38
+ user_agent: str = f"mailcycle-python/{__version__}",
38
39
  ) -> None:
39
40
  self.base_url = base_url.rstrip("/")
40
41
  self._token = token
@@ -118,7 +118,7 @@ def test_a_drop_is_survived_and_announced():
118
118
 
119
119
  def test_a_refusal_stops_the_stream_rather_than_reconnecting():
120
120
  def script(server, connection):
121
- connection.send(json.dumps({"type": "error", "code": "plan_required", "message": "Scale and up."}))
121
+ connection.send(json.dumps({"type": "error", "code": "plan_required", "message": "Operator and up."}))
122
122
  time.sleep(0.3)
123
123
 
124
124
  errors: list[tuple[str, str]] = []
@@ -129,7 +129,7 @@ def test_a_refusal_stops_the_stream_rather_than_reconnecting():
129
129
  assert stream.next_event(timeout=10) is None
130
130
  assert stream.ended
131
131
  assert stream.closed_reason[1] == "plan_required"
132
- assert errors == [("plan_required", "Scale and up.")]
132
+ assert errors == [("plan_required", "Operator and up.")]
133
133
  time.sleep(1)
134
134
  assert server.connections == 1 # No hammering after a refusal.
135
135
  stream.close()
@@ -138,10 +138,10 @@ def test_a_refusal_stops_the_stream_rather_than_reconnecting():
138
138
 
139
139
 
140
140
  def test_a_refused_stream_is_not_open_and_keeps_its_close_code():
141
- # What the live API does for a key below Scale: accept the upgrade, send an
141
+ # What the live API does for a key without the stream: accept the upgrade, send an
142
142
  # error frame, close with 4003.
143
143
  def script(server, connection):
144
- connection.send(json.dumps({"type": "error", "code": "plan_required", "message": "Scale and up."}))
144
+ connection.send(json.dumps({"type": "error", "code": "plan_required", "message": "Operator and up."}))
145
145
  connection.close(4003, "plan_required")
146
146
 
147
147
  server = Server(script)
File without changes
File without changes
File without changes