carrier-python 0.1.33__tar.gz → 0.1.34__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.
- {carrier_python-0.1.33 → carrier_python-0.1.34}/PKG-INFO +1 -1
- {carrier_python-0.1.33 → carrier_python-0.1.34}/pyproject.toml +1 -1
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/resources.py +19 -3
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/version.py +1 -1
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier_python.egg-info/PKG-INFO +1 -1
- {carrier_python-0.1.33 → carrier_python-0.1.34}/tests/test_client.py +19 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/tests/test_surface.py +1 -1
- {carrier_python-0.1.33 → carrier_python-0.1.34}/README.md +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/setup.cfg +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/__init__.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/adapters.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/catalog.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/cli.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/client.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/data/cli.json +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/data/operations.json +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/errors.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/http.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/idempotency.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/mcp.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/models.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/operation_ids.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/operations.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/py.typed +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/records.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier/signature.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier_python.egg-info/SOURCES.txt +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier_python.egg-info/dependency_links.txt +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier_python.egg-info/top_level.txt +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/tests/test_issuance.py +0 -0
- {carrier_python-0.1.33 → carrier_python-0.1.34}/tests/test_signature.py +0 -0
|
@@ -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,
|
|
244
|
-
"""GET /v1/connectivity/intents/:
|
|
245
|
-
|
|
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)
|
|
@@ -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.
|
|
204
|
+
self.assertEqual(version, "0.1.34")
|
|
205
205
|
self.assertEqual(version, __version__)
|
|
206
206
|
with (package / "uv.lock").open("rb") as handle:
|
|
207
207
|
lock = tomllib.load(handle)
|
|
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
|
{carrier_python-0.1.33 → carrier_python-0.1.34}/src/carrier_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|