karrio-teleship 2026.1.4__py3-none-any.whl → 2026.1.5__py3-none-any.whl

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.
@@ -33,6 +33,7 @@ class Proxy(proxy.Proxy):
33
33
  )
34
34
  ),
35
35
  decoder=lib.to_dict,
36
+ on_error=lib.error_decoder,
36
37
  )
37
38
 
38
39
  messages = provider_error.parse_error_response(response, self.settings)
@@ -24,6 +24,7 @@ METADATA = PluginMetadata(
24
24
  is_hub=False,
25
25
  options=units.ShippingOption,
26
26
  services=units.ShippingService,
27
+ service_levels=units.DEFAULT_SERVICES,
27
28
  connection_configs=units.ConnectionConfig,
28
29
  system_config=units.SYSTEM_CONFIG,
29
30
  # Extra info
@@ -1,5 +1,9 @@
1
+ import csv
2
+ import pathlib
3
+
1
4
  import karrio.lib as lib
2
5
  import karrio.core.units as units
6
+ import karrio.core.models as models
3
7
 
4
8
 
5
9
  # System config schema for runtime settings (e.g., OAuth credentials)
@@ -152,3 +156,45 @@ class TrackingStatus(lib.Enum):
152
156
  out_for_delivery = ["out_for_delivery"]
153
157
  delivery_failed = ["delivery_failed", "returned", "cancelled"]
154
158
  pending = ["pending", "created", "label_created"]
159
+
160
+
161
+ def load_services_from_csv() -> list:
162
+ csv_path = pathlib.Path(__file__).resolve().parent / "services.csv"
163
+ if not csv_path.exists():
164
+ return []
165
+ services_dict: dict[str, dict] = {}
166
+ with open(csv_path, "r", encoding="utf-8") as f:
167
+ reader = csv.DictReader(f)
168
+ for row in reader:
169
+ service_code = row["service_code"]
170
+ karrio_service_code = ShippingService.map(service_code).name_or_key
171
+ if karrio_service_code not in services_dict:
172
+ services_dict[karrio_service_code] = {
173
+ "service_name": row["service_name"],
174
+ "service_code": karrio_service_code,
175
+ "currency": row.get("currency", "USD"),
176
+ "min_weight": float(row["min_weight"]) if row.get("min_weight") else None,
177
+ "max_weight": float(row["max_weight"]) if row.get("max_weight") else None,
178
+ "max_length": float(row["max_length"]) if row.get("max_length") else None,
179
+ "max_width": float(row["max_width"]) if row.get("max_width") else None,
180
+ "max_height": float(row["max_height"]) if row.get("max_height") else None,
181
+ "weight_unit": "KG",
182
+ "dimension_unit": "CM",
183
+ "domicile": (row.get("domicile") or "").lower() == "true",
184
+ "international": True if (row.get("international") or "").lower() == "true" else None,
185
+ "zones": [],
186
+ }
187
+ country_codes = [c.strip() for c in row.get("country_codes", "").split(",") if c.strip()]
188
+ zone = models.ServiceZone(
189
+ label=row.get("zone_label", "Default Zone"),
190
+ rate=float(row.get("rate", 0.0)),
191
+ min_weight=float(row["min_weight"]) if row.get("min_weight") else None,
192
+ max_weight=float(row["max_weight"]) if row.get("max_weight") else None,
193
+ transit_days=int(row["transit_days"].split("-")[0]) if row.get("transit_days") and row["transit_days"].split("-")[0].isdigit() else None,
194
+ country_codes=country_codes if country_codes else None,
195
+ )
196
+ services_dict[karrio_service_code]["zones"].append(zone)
197
+ return [models.ServiceLevel(**service_data) for service_data in services_dict.values()]
198
+
199
+
200
+ DEFAULT_SERVICES = load_services_from_csv()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: karrio_teleship
3
- Version: 2026.1.4
3
+ Version: 2026.1.5
4
4
  Summary: Karrio - Teleship Shipping Extension
5
5
  Author-email: karrio <hello@karrio.io>
6
6
  License-Expression: LGPL-3.0
@@ -1,16 +1,16 @@
1
1
  karrio/mappers/teleship/__init__.py,sha256=ndmmJV0II3YtmYSFNORof8E9vSs5PbK_VsFZgRk0KKo,200
2
2
  karrio/mappers/teleship/hooks.py,sha256=WfcykkaQloNYdBOxl-nAKBtTOPnMUna_dJXdQIo1eOo,984
3
3
  karrio/mappers/teleship/mapper.py,sha256=VQGqIq3LK21vvWlJw7dCc7DV6y4RQLTbBk6gTmyuLEU,4656
4
- karrio/mappers/teleship/proxy.py,sha256=7Pz41Mv4xa1gnpxCyUE2JHmkeNYNQXY_vCCnpC275Qw,8679
4
+ karrio/mappers/teleship/proxy.py,sha256=l_g7ox6kH790NKzGiedxh-4JYlEI4zSOHy26j6JEM_4,8723
5
5
  karrio/mappers/teleship/settings.py,sha256=I7dBQxnYk92pPjUaXT9bO0DE7XM3gNtn7sioEc2Nko8,509
6
- karrio/plugins/teleship/__init__.py,sha256=Jk_0KvE7MgmVmiyYsoVU6xIF8lY02SaQRxS5Y3lMg4o,1235
6
+ karrio/plugins/teleship/__init__.py,sha256=RfWhb2BWogXTLbsWXnMGFfwTesON_hMYiNSSU0OBZDE,1278
7
7
  karrio/providers/teleship/__init__.py,sha256=SXObOsSC4QU6hPkBHkkBqVsMrQ9oTqG5rbx25W1yWLw,1151
8
8
  karrio/providers/teleship/duties.py,sha256=lYlELXTiLdszzm8emgPExWGfRu9xl-Odu6ZmYXFiWRI,4387
9
9
  karrio/providers/teleship/error.py,sha256=x40Iu5uSOZUhInpL6PRF3tdfL67RQmVyvV1zIoKp_uE,1429
10
10
  karrio/providers/teleship/manifest.py,sha256=XA0HpB6ELeNim3zJAqy0_y6kApeTr5n5EbAJJlKzmnc,2226
11
11
  karrio/providers/teleship/rate.py,sha256=FpuNed80NwbsLUVn2WaaLr08SwsJ5dg_72iacEsrDvI,12129
12
12
  karrio/providers/teleship/tracking.py,sha256=TEsy54RO0b9CiI9yT10NRcrRQ5jgtZ9_xaMpJKwYjYY,4006
13
- karrio/providers/teleship/units.py,sha256=Tzkfy5SKX3r91JGE859rNiJWFPUJfaMM-IrFIaFj--c,4431
13
+ karrio/providers/teleship/units.py,sha256=YxkoiyDxctC7Uxk8bv6atEA8iBAufd6aDtsoEDWhkcI,6891
14
14
  karrio/providers/teleship/utils.py,sha256=iZQq5_owHNHxgB7Gv5nDIJMLJR1brbW3am4UdrDpNxU,1502
15
15
  karrio/providers/teleship/hooks/__init__.py,sha256=7o-K0LI2VS54Y1-k1kmz9TDL_mpUsnfhX5muHFEWb08,168
16
16
  karrio/providers/teleship/hooks/event.py,sha256=ZoTx2tsKdnR2lhdo4NCABBsLwHsC47C7DozS9t4xUyI,5632
@@ -42,8 +42,8 @@ karrio/schemas/teleship/tracking_request.py,sha256=rGU1_Cx3Rar00J_PercC1WBSgD0cK
42
42
  karrio/schemas/teleship/tracking_response.py,sha256=0pfLgk-1j3As1-M2jTW-SpQACIp5kGNRweCYc6mzrM0,1688
43
43
  karrio/schemas/teleship/webhook_request.py,sha256=1JhQ81zxtAAIKU-obaYdtxbB6d0xmQVvkxujgQJVtIk,490
44
44
  karrio/schemas/teleship/webhook_response.py,sha256=09fB-GAkiWGknwsSoajv4FJh0qE9Mhv6yTq4WmHM0io,567
45
- karrio_teleship-2026.1.4.dist-info/METADATA,sha256=UAb41DyHHPaMpX0BIRBCfw50PHRK2X6nGndhflHa9zI,998
46
- karrio_teleship-2026.1.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
47
- karrio_teleship-2026.1.4.dist-info/entry_points.txt,sha256=MFOQ3oh1VLrZLEt3frxlKUYUjr2shc4rrGzN-4G_IfU,61
48
- karrio_teleship-2026.1.4.dist-info/top_level.txt,sha256=O5sHlZk5x6tTDjFXt04IEVere9HmmEs-ksEOB6dzoYE,28
49
- karrio_teleship-2026.1.4.dist-info/RECORD,,
45
+ karrio_teleship-2026.1.5.dist-info/METADATA,sha256=U6RJ9_LgEQdrHQJCvs-OZrflAL8s6b6GjJICGiHI654,998
46
+ karrio_teleship-2026.1.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
47
+ karrio_teleship-2026.1.5.dist-info/entry_points.txt,sha256=MFOQ3oh1VLrZLEt3frxlKUYUjr2shc4rrGzN-4G_IfU,61
48
+ karrio_teleship-2026.1.5.dist-info/top_level.txt,sha256=O5sHlZk5x6tTDjFXt04IEVere9HmmEs-ksEOB6dzoYE,28
49
+ karrio_teleship-2026.1.5.dist-info/RECORD,,