carrier-python 0.1.33__tar.gz → 0.1.35__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 (31) hide show
  1. {carrier_python-0.1.33 → carrier_python-0.1.35}/PKG-INFO +1 -1
  2. {carrier_python-0.1.33 → carrier_python-0.1.35}/pyproject.toml +1 -1
  3. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/data/cli.json +2 -2
  4. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/data/operations.json +1 -1
  5. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/resources.py +19 -3
  6. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/version.py +1 -1
  7. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier_python.egg-info/PKG-INFO +1 -1
  8. {carrier_python-0.1.33 → carrier_python-0.1.35}/tests/test_client.py +19 -0
  9. {carrier_python-0.1.33 → carrier_python-0.1.35}/tests/test_surface.py +1 -1
  10. {carrier_python-0.1.33 → carrier_python-0.1.35}/README.md +0 -0
  11. {carrier_python-0.1.33 → carrier_python-0.1.35}/setup.cfg +0 -0
  12. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/__init__.py +0 -0
  13. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/adapters.py +0 -0
  14. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/catalog.py +0 -0
  15. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/cli.py +0 -0
  16. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/client.py +0 -0
  17. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/errors.py +0 -0
  18. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/http.py +0 -0
  19. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/idempotency.py +0 -0
  20. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/mcp.py +0 -0
  21. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/models.py +0 -0
  22. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/operation_ids.py +0 -0
  23. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/operations.py +0 -0
  24. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/py.typed +0 -0
  25. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/records.py +0 -0
  26. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier/signature.py +0 -0
  27. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier_python.egg-info/SOURCES.txt +0 -0
  28. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier_python.egg-info/dependency_links.txt +0 -0
  29. {carrier_python-0.1.33 → carrier_python-0.1.35}/src/carrier_python.egg-info/top_level.txt +0 -0
  30. {carrier_python-0.1.33 → carrier_python-0.1.35}/tests/test_issuance.py +0 -0
  31. {carrier_python-0.1.33 → carrier_python-0.1.35}/tests/test_signature.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: carrier-python
3
- Version: 0.1.33
3
+ Version: 0.1.35
4
4
  Summary: Python client for the Carrier API, MCP server, and CLI.
5
5
  Author: Lifecycle Innovations Limited
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "carrier-python"
7
- version = "0.1.33"
7
+ version = "0.1.35"
8
8
  description = "Python client for the Carrier API, MCP server, and CLI."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -2096,7 +2096,7 @@
2096
2096
  {
2097
2097
  "invocation": "carrier billing ai-credits",
2098
2098
  "domain": "billing",
2099
- "summary": "Read your organization's AI credit wallet in EUR: balance_eur and available_eur.",
2099
+ "summary": "Read your organization's AI credit wallet in USD: balance_usd and available_usd.",
2100
2100
  "write": false,
2101
2101
  "transport": "mcp",
2102
2102
  "tool": "ai_credit_balance",
@@ -2208,7 +2208,7 @@
2208
2208
  {
2209
2209
  "invocation": "carrier ai-wallet auto-topup",
2210
2210
  "domain": "ai-wallet",
2211
- "summary": "Read or change automatic EUR replenishment for the separate AI-credit wallet.",
2211
+ "summary": "Read or change automatic USD replenishment for the separate AI-credit wallet.",
2212
2212
  "write": true,
2213
2213
  "transport": "mcp",
2214
2214
  "tool": "ai_wallet_auto_topup",
@@ -1948,7 +1948,7 @@
1948
1948
  "method": "GET",
1949
1949
  "path": "/v1/ai/wallet",
1950
1950
  "tag": "AI",
1951
- "summary": "Read your organization's AI credits in EUR",
1951
+ "summary": "Read your organization's AI credits in USD",
1952
1952
  "security": "bearer",
1953
1953
  "body": false,
1954
1954
  "bodyRequired": false,
@@ -1,5 +1,6 @@
1
1
  """Resource clients. Each method maps to one connectivity route."""
2
2
 
3
+ import re
3
4
  from collections.abc import Mapping, Sequence
4
5
  from typing import Any
5
6
 
@@ -16,6 +17,9 @@ from carrier.records import (
16
17
  )
17
18
 
18
19
 
20
+ INTENT_ID_PATTERN = re.compile(r"cni_[0-9a-f]{32}")
21
+
22
+
19
23
  class Intents:
20
24
  """Issue, read, and confirm connectivity intents."""
21
25
 
@@ -240,9 +244,21 @@ class ESIMsResource:
240
244
  except Exception:
241
245
  return payload
242
246
 
243
- def get(self, iccid: str) -> Any:
244
- """GET /v1/connectivity/intents/:iccid."""
245
- path = f"/v1/connectivity/intents/{require_id(iccid, 'esim')}"
247
+ def get(self, intent_id: str) -> Any:
248
+ """GET /v1/connectivity/intents/:id, by intent id (cni_ and 32 hex digits).
249
+
250
+ The API has no lookup by ICCID. Read the ICCID from the returned
251
+ ``esim.iccid``. Anything that is not an intent id fails before any request.
252
+ """
253
+ safe = require_id(intent_id, "esim")
254
+ if INTENT_ID_PATTERN.fullmatch(safe) is None:
255
+ raise CarrierError(
256
+ 400,
257
+ "invalid_id",
258
+ "esim lookup takes an intent id (cni_ and 32 hex digits). "
259
+ "An ICCID is not accepted; read it from esim.iccid.",
260
+ )
261
+ path = f"/v1/connectivity/intents/{safe}"
246
262
  payload = self._http.request("GET", path)
247
263
  if isinstance(payload, dict) and payload.get("object") == "connectivity.intent":
248
264
  return ConnectivityIntent.from_dict(payload)
@@ -1,3 +1,3 @@
1
1
  """Package version. Kept beside the HTTP client so the user agent stays in sync."""
2
2
 
3
- __version__ = "0.1.33"
3
+ __version__ = "0.1.35"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: carrier-python
3
- Version: 0.1.33
3
+ Version: 0.1.35
4
4
  Summary: Python client for the Carrier API, MCP server, and CLI.
5
5
  Author: Lifecycle Innovations Limited
6
6
  License: MIT
@@ -214,6 +214,25 @@ class ClientTest(unittest.TestCase):
214
214
  carrier.esims.get("../bad")
215
215
  self.assertEqual(raised.exception.code, "invalid_id")
216
216
 
217
+ def test_esims_get_rejects_non_intent_ids_before_any_request(self) -> None:
218
+ capture = Capture(200, INTENT)
219
+ carrier = Carrier("ak_test", base_url="https://api.test", transport=capture)
220
+
221
+ for value in (
222
+ "8900000000000000001",
223
+ "cni_short",
224
+ "cni_0123456789ABCDEF0123456789ABCDEF",
225
+ "cni_0123456789abcdef0123456789abcdef0",
226
+ "xcni_0123456789abcdef0123456789abcdef",
227
+ ):
228
+ with self.subTest(value=value):
229
+ with self.assertRaises(CarrierError) as raised:
230
+ carrier.esims.get(value)
231
+ self.assertEqual(raised.exception.status, 400)
232
+ self.assertEqual(raised.exception.code, "invalid_id")
233
+ self.assertIn("An ICCID is not accepted", str(raised.exception))
234
+ self.assertEqual(capture.calls, [])
235
+
217
236
  def test_sandbox_resource_carriers_and_simulate(self) -> None:
218
237
  carriers_data = {
219
238
  "object": "list",
@@ -201,7 +201,7 @@ class SurfaceTest(unittest.TestCase):
201
201
  package = Path(__file__).resolve().parents[1]
202
202
  with (package / "pyproject.toml").open("rb") as handle:
203
203
  version = tomllib.load(handle)["project"]["version"]
204
- self.assertEqual(version, "0.1.33")
204
+ self.assertEqual(version, "0.1.35")
205
205
  self.assertEqual(version, __version__)
206
206
  with (package / "uv.lock").open("rb") as handle:
207
207
  lock = tomllib.load(handle)