karrio-canadapost 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.
- karrio/plugins/canadapost/__init__.py +1 -0
- karrio/providers/canadapost/units.py +45 -0
- {karrio_canadapost-2026.1.4.dist-info → karrio_canadapost-2026.1.5.dist-info}/METADATA +1 -1
- {karrio_canadapost-2026.1.4.dist-info → karrio_canadapost-2026.1.5.dist-info}/RECORD +7 -7
- {karrio_canadapost-2026.1.4.dist-info → karrio_canadapost-2026.1.5.dist-info}/WHEEL +0 -0
- {karrio_canadapost-2026.1.4.dist-info → karrio_canadapost-2026.1.5.dist-info}/entry_points.txt +0 -0
- {karrio_canadapost-2026.1.4.dist-info → karrio_canadapost-2026.1.5.dist-info}/top_level.txt +0 -0
|
@@ -15,6 +15,7 @@ METADATA = metadata.PluginMetadata(
|
|
|
15
15
|
options=units.ShippingOption,
|
|
16
16
|
package_presets=units.PackagePresets,
|
|
17
17
|
services=units.ServiceType,
|
|
18
|
+
service_levels=units.DEFAULT_SERVICES,
|
|
18
19
|
connection_configs=units.ConnectionConfig,
|
|
19
20
|
# New fields
|
|
20
21
|
website="https://www.canadapost-postescanada.ca/cpc/en/home.page",
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import csv
|
|
2
|
+
import pathlib
|
|
1
3
|
import karrio.lib as lib
|
|
4
|
+
import karrio.core.models as models
|
|
2
5
|
|
|
3
6
|
PRESET_DEFAULTS = dict(
|
|
4
7
|
dimension_unit="CM",
|
|
@@ -333,3 +336,45 @@ CUSTOM_OPTIONS = [
|
|
|
333
336
|
ShippingOption.canadapost_cost_center.name,
|
|
334
337
|
ShippingOption.canadapost_submit_shipment.name,
|
|
335
338
|
]
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def load_services_from_csv() -> list:
|
|
342
|
+
csv_path = pathlib.Path(__file__).resolve().parent / "services.csv"
|
|
343
|
+
if not csv_path.exists():
|
|
344
|
+
return []
|
|
345
|
+
services_dict: dict[str, dict] = {}
|
|
346
|
+
with open(csv_path, "r", encoding="utf-8") as f:
|
|
347
|
+
reader = csv.DictReader(f)
|
|
348
|
+
for row in reader:
|
|
349
|
+
service_code = row["service_code"]
|
|
350
|
+
karrio_service_code = ServiceType.map(service_code).name_or_key
|
|
351
|
+
if karrio_service_code not in services_dict:
|
|
352
|
+
services_dict[karrio_service_code] = {
|
|
353
|
+
"service_name": row["service_name"],
|
|
354
|
+
"service_code": karrio_service_code,
|
|
355
|
+
"currency": row.get("currency", "CAD"),
|
|
356
|
+
"min_weight": float(row["min_weight"]) if row.get("min_weight") else None,
|
|
357
|
+
"max_weight": float(row["max_weight"]) if row.get("max_weight") else None,
|
|
358
|
+
"max_length": float(row["max_length"]) if row.get("max_length") else None,
|
|
359
|
+
"max_width": float(row["max_width"]) if row.get("max_width") else None,
|
|
360
|
+
"max_height": float(row["max_height"]) if row.get("max_height") else None,
|
|
361
|
+
"weight_unit": "KG",
|
|
362
|
+
"dimension_unit": "CM",
|
|
363
|
+
"domicile": (row.get("domicile") or "").lower() == "true",
|
|
364
|
+
"international": True if (row.get("international") or "").lower() == "true" else None,
|
|
365
|
+
"zones": [],
|
|
366
|
+
}
|
|
367
|
+
country_codes = [c.strip() for c in row.get("country_codes", "").split(",") if c.strip()]
|
|
368
|
+
zone = models.ServiceZone(
|
|
369
|
+
label=row.get("zone_label", "Default Zone"),
|
|
370
|
+
rate=float(row.get("rate", 0.0)),
|
|
371
|
+
min_weight=float(row["min_weight"]) if row.get("min_weight") else None,
|
|
372
|
+
max_weight=float(row["max_weight"]) if row.get("max_weight") else None,
|
|
373
|
+
transit_days=int(row["transit_days"].split("-")[0]) if row.get("transit_days") and row["transit_days"].split("-")[0].isdigit() else None,
|
|
374
|
+
country_codes=country_codes if country_codes else None,
|
|
375
|
+
)
|
|
376
|
+
services_dict[karrio_service_code]["zones"].append(zone)
|
|
377
|
+
return [models.ServiceLevel(**service_data) for service_data in services_dict.values()]
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
DEFAULT_SERVICES = load_services_from_csv()
|
|
@@ -2,13 +2,13 @@ karrio/mappers/canadapost/__init__.py,sha256=l2QCRrKKsOToc8Q3YHgsLKK3fDDqYDSDJWI
|
|
|
2
2
|
karrio/mappers/canadapost/mapper.py,sha256=asYfH9mAO5d1E4Zf4zZwYwa2Q-oRRpDpprWaJrDy1co,3612
|
|
3
3
|
karrio/mappers/canadapost/proxy.py,sha256=PA-KLsDPjggg37iTu8_e-ATOMuptx-Tzv5soP7OJKC4,15366
|
|
4
4
|
karrio/mappers/canadapost/settings.py,sha256=Dq2BI7n4HEkZ4juXiQEvYAwJebW18SyOCuDebQ5zqCo,553
|
|
5
|
-
karrio/plugins/canadapost/__init__.py,sha256=
|
|
5
|
+
karrio/plugins/canadapost/__init__.py,sha256=ZlZmO5MB72lruUpIZdVFVOP9xaY7XMpUWYvIxMhxbUk,808
|
|
6
6
|
karrio/providers/canadapost/__init__.py,sha256=3UB1PI83_GZt2e0mQf_9lIye1vXjUwuMH-_sUkqIFNk,791
|
|
7
7
|
karrio/providers/canadapost/error.py,sha256=xkNQE4kj-MvACCxQUHoI7Xj-JiofFHIL4eFOIsJZ3Tg,1185
|
|
8
8
|
karrio/providers/canadapost/manifest.py,sha256=8kX-1CV_5JAjp978s_eHy4HlHqkcpkbG0bRclkyGqBc,4674
|
|
9
9
|
karrio/providers/canadapost/rate.py,sha256=35tGjUjtF2AwPSv8RWfbHGDFHvQ5Eg2OoTLny30UFC8,7261
|
|
10
10
|
karrio/providers/canadapost/tracking.py,sha256=F84O2mW1oir8R2tDH0jCBN9KstN7ANtRRhBteUVN4mk,3540
|
|
11
|
-
karrio/providers/canadapost/units.py,sha256=
|
|
11
|
+
karrio/providers/canadapost/units.py,sha256=90ezMKxFKnQJlrvm_LWqeXvb0p5euDwr0hLoO5rn3rI,12799
|
|
12
12
|
karrio/providers/canadapost/utils.py,sha256=xoRVwEjDmdJ8qg-88WYmz-0zGTzQC1i8D-U_9J7G09s,2515
|
|
13
13
|
karrio/providers/canadapost/pickup/__init__.py,sha256=uLN8GzjaW1ezPty1NxIKKFouHwkMGeYsdK_yAg7OwxE,304
|
|
14
14
|
karrio/providers/canadapost/pickup/cancel.py,sha256=io3_KxVzwAkH1zcIc1ycPwf_Up16mI_pgT84BCu0P3k,1001
|
|
@@ -34,8 +34,8 @@ karrio/schemas/canadapost/rating.py,sha256=Iaoagbm6L6A62GwI4PRB_2ZGZ1WpIbtogn9vg
|
|
|
34
34
|
karrio/schemas/canadapost/serviceinfo.py,sha256=gV0CYy7rcoTcVOYmKL9nLCqdVeQVERK8_vNvk9jn8eM,60134
|
|
35
35
|
karrio/schemas/canadapost/shipment.py,sha256=5xbnYyC8Mufsv2DJ11wk45yx1e2fK84UO-_3SSt5i-k,525576
|
|
36
36
|
karrio/schemas/canadapost/track.py,sha256=Va7-OB0sztIz9pu0VaTKaNDMUVPC1AXCTPDePdyX84Q,150548
|
|
37
|
-
karrio_canadapost-2026.1.
|
|
38
|
-
karrio_canadapost-2026.1.
|
|
39
|
-
karrio_canadapost-2026.1.
|
|
40
|
-
karrio_canadapost-2026.1.
|
|
41
|
-
karrio_canadapost-2026.1.
|
|
37
|
+
karrio_canadapost-2026.1.5.dist-info/METADATA,sha256=jlK6Bom-luS7cMVy4i0vkZYBo0xWsBO3D3JwaM-fsLQ,1016
|
|
38
|
+
karrio_canadapost-2026.1.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
39
|
+
karrio_canadapost-2026.1.5.dist-info/entry_points.txt,sha256=dU9l-mw14-Lg7pHChydFReVeE2OV8wwOM15AQQkbhvw,65
|
|
40
|
+
karrio_canadapost-2026.1.5.dist-info/top_level.txt,sha256=FZCY8Nwft8oEGHdl--xku8P3TrnOxu5dETEU_fWpRSM,20
|
|
41
|
+
karrio_canadapost-2026.1.5.dist-info/RECORD,,
|
|
File without changes
|
{karrio_canadapost-2026.1.4.dist-info → karrio_canadapost-2026.1.5.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|