karrio-dhl-poland 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/providers/dhl_poland/units.py +54 -44
- {karrio_dhl_poland-2026.1.4.dist-info → karrio_dhl_poland-2026.1.5.dist-info}/METADATA +1 -1
- {karrio_dhl_poland-2026.1.4.dist-info → karrio_dhl_poland-2026.1.5.dist-info}/RECORD +6 -6
- {karrio_dhl_poland-2026.1.4.dist-info → karrio_dhl_poland-2026.1.5.dist-info}/WHEEL +0 -0
- {karrio_dhl_poland-2026.1.4.dist-info → karrio_dhl_poland-2026.1.5.dist-info}/entry_points.txt +0 -0
- {karrio_dhl_poland-2026.1.4.dist-info → karrio_dhl_poland-2026.1.5.dist-info}/top_level.txt +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import csv
|
|
2
|
+
import pathlib
|
|
3
|
+
|
|
1
4
|
import karrio.lib as lib
|
|
2
5
|
import karrio.core.units as units
|
|
3
6
|
import karrio.core.models as models
|
|
@@ -100,47 +103,54 @@ def shipping_options_initializer(
|
|
|
100
103
|
return units.ShippingOptions(_options, ShippingOption, items_filter=items_filter)
|
|
101
104
|
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
]
|
|
106
|
+
def load_services_from_csv() -> list:
|
|
107
|
+
csv_path = pathlib.Path(__file__).resolve().parent / "services.csv"
|
|
108
|
+
if not csv_path.exists():
|
|
109
|
+
return []
|
|
110
|
+
services_dict: dict[str, dict] = {}
|
|
111
|
+
with open(csv_path, "r", encoding="utf-8") as f:
|
|
112
|
+
reader = csv.DictReader(f)
|
|
113
|
+
for row in reader:
|
|
114
|
+
service_code = row["service_code"]
|
|
115
|
+
karrio_service_code = Service.map(service_code).name_or_key
|
|
116
|
+
row_min_weight = float(row["min_weight"]) if row.get("min_weight") else None
|
|
117
|
+
row_max_weight = float(row["max_weight"]) if row.get("max_weight") else None
|
|
118
|
+
if karrio_service_code not in services_dict:
|
|
119
|
+
services_dict[karrio_service_code] = {
|
|
120
|
+
"service_name": row["service_name"],
|
|
121
|
+
"service_code": karrio_service_code,
|
|
122
|
+
"currency": row.get("currency", "PLN"),
|
|
123
|
+
"min_weight": row_min_weight,
|
|
124
|
+
"max_weight": row_max_weight,
|
|
125
|
+
"max_length": float(row["max_length"]) if row.get("max_length") else None,
|
|
126
|
+
"max_width": float(row["max_width"]) if row.get("max_width") else None,
|
|
127
|
+
"max_height": float(row["max_height"]) if row.get("max_height") else None,
|
|
128
|
+
"weight_unit": "KG",
|
|
129
|
+
"dimension_unit": "CM",
|
|
130
|
+
"domicile": True if (row.get("domicile") or "").lower() == "true" else None,
|
|
131
|
+
"international": True if (row.get("international") or "").lower() == "true" else None,
|
|
132
|
+
"zones": [],
|
|
133
|
+
}
|
|
134
|
+
else:
|
|
135
|
+
# Update service-level weight bounds to cover all zones
|
|
136
|
+
current = services_dict[karrio_service_code]
|
|
137
|
+
if row_min_weight is not None:
|
|
138
|
+
if current["min_weight"] is None or row_min_weight < current["min_weight"]:
|
|
139
|
+
current["min_weight"] = row_min_weight
|
|
140
|
+
if row_max_weight is not None:
|
|
141
|
+
if current["max_weight"] is None or row_max_weight > current["max_weight"]:
|
|
142
|
+
current["max_weight"] = row_max_weight
|
|
143
|
+
country_codes = [c.strip() for c in row.get("country_codes", "").split(",") if c.strip()]
|
|
144
|
+
zone = models.ServiceZone(
|
|
145
|
+
label=row.get("zone_label", "Default Zone"),
|
|
146
|
+
rate=float(row.get("rate", 0.0)),
|
|
147
|
+
min_weight=row_min_weight,
|
|
148
|
+
max_weight=row_max_weight,
|
|
149
|
+
transit_days=int(row["transit_days"].split("-")[0]) if row.get("transit_days") and row["transit_days"].split("-")[0].isdigit() else None,
|
|
150
|
+
country_codes=country_codes if country_codes else None,
|
|
151
|
+
)
|
|
152
|
+
services_dict[karrio_service_code]["zones"].append(zone)
|
|
153
|
+
return [models.ServiceLevel(**service_data) for service_data in services_dict.values()]
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
DEFAULT_SERVICES = load_services_from_csv()
|
|
@@ -6,15 +6,15 @@ karrio/plugins/dhl_poland/__init__.py,sha256=MdBRoFyYsyc8APZ8PI3Esn6kZOlwAtC66hc
|
|
|
6
6
|
karrio/providers/dhl_poland/__init__.py,sha256=oLgXPC778tlkc-zFag7y40sBkgvf5IsTtt10FZ_e9Xk,328
|
|
7
7
|
karrio/providers/dhl_poland/error.py,sha256=OXxiuVdmtW55THG8Uv0UTDC-wXoj_CENVRLK6niV6vs,621
|
|
8
8
|
karrio/providers/dhl_poland/tracking.py,sha256=IxOu5ken3OTHRJm0WEmUrj_Ni9uKdShXV1xkTJQ-Zag,3068
|
|
9
|
-
karrio/providers/dhl_poland/units.py,sha256=
|
|
9
|
+
karrio/providers/dhl_poland/units.py,sha256=LmuMjMnUsJUFXH7bOi97W0CFnipJ75K1uYsyLWazK6I,6220
|
|
10
10
|
karrio/providers/dhl_poland/utils.py,sha256=fCajKIynwom0mPk8Ev3VYbNMZxrDHKpKZGsZSkrpwJo,1862
|
|
11
11
|
karrio/providers/dhl_poland/shipment/__init__.py,sha256=kH1OP9BIPNfzxj6k41NI5TGBQX6CZ9y0qinn3BkL9xI,236
|
|
12
12
|
karrio/providers/dhl_poland/shipment/cancel.py,sha256=OHFV3O6NjuZ0dcjb_bkX2RvX9y5vBJcSCv_enKwuyOA,1576
|
|
13
13
|
karrio/providers/dhl_poland/shipment/create.py,sha256=1DF1LX7qpiwfuu_4D4t9Z3BE6HFIOwhFmozcCh_D3cU,13464
|
|
14
14
|
karrio/schemas/dhl_poland/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
karrio/schemas/dhl_poland/services.py,sha256=f1fyVKQfVce7u-UzSGGU2Xbac7Ulg98rXwckXahvC8M,1471874
|
|
16
|
-
karrio_dhl_poland-2026.1.
|
|
17
|
-
karrio_dhl_poland-2026.1.
|
|
18
|
-
karrio_dhl_poland-2026.1.
|
|
19
|
-
karrio_dhl_poland-2026.1.
|
|
20
|
-
karrio_dhl_poland-2026.1.
|
|
16
|
+
karrio_dhl_poland-2026.1.5.dist-info/METADATA,sha256=bJlGvXCn9j1CWQ86694cvpOKmXV_lLAPTtdvjvZywG4,1028
|
|
17
|
+
karrio_dhl_poland-2026.1.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
18
|
+
karrio_dhl_poland-2026.1.5.dist-info/entry_points.txt,sha256=dszDSNQ_aAw9xldHUTWmvd6OoTldQje9eMlYH0hN9QE,65
|
|
19
|
+
karrio_dhl_poland-2026.1.5.dist-info/top_level.txt,sha256=FZCY8Nwft8oEGHdl--xku8P3TrnOxu5dETEU_fWpRSM,20
|
|
20
|
+
karrio_dhl_poland-2026.1.5.dist-info/RECORD,,
|
|
File without changes
|
{karrio_dhl_poland-2026.1.4.dist-info → karrio_dhl_poland-2026.1.5.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|