karrio 2023.9.2__py3-none-any.whl → 2025.5rc3__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/__init__.py +0 -100
- karrio/addons/renderer.py +1 -1
- karrio/api/gateway.py +58 -35
- karrio/api/interface.py +41 -4
- karrio/api/mapper.py +39 -0
- karrio/api/proxy.py +18 -5
- karrio/core/__init__.py +5 -1
- karrio/core/metadata.py +113 -20
- karrio/core/models.py +64 -5
- karrio/core/plugins.py +606 -0
- karrio/core/settings.py +39 -2
- karrio/core/units.py +574 -29
- karrio/core/utils/datetime.py +62 -2
- karrio/core/utils/dict.py +5 -0
- karrio/core/utils/enum.py +98 -13
- karrio/core/utils/helpers.py +83 -32
- karrio/core/utils/number.py +52 -8
- karrio/core/utils/string.py +52 -1
- karrio/core/utils/transformer.py +9 -4
- karrio/core/validators.py +88 -0
- karrio/lib.py +147 -2
- karrio/plugins/__init__.py +6 -0
- karrio/references.py +652 -67
- karrio/sdk.py +102 -0
- karrio/universal/mappers/rating_proxy.py +35 -9
- karrio/validators/__init__.py +6 -0
- {karrio-2023.9.2.dist-info → karrio-2025.5rc3.dist-info}/METADATA +9 -8
- karrio-2025.5rc3.dist-info/RECORD +57 -0
- {karrio-2023.9.2.dist-info → karrio-2025.5rc3.dist-info}/WHEEL +1 -1
- {karrio-2023.9.2.dist-info → karrio-2025.5rc3.dist-info}/top_level.txt +1 -0
- karrio-2023.9.2.dist-info/RECORD +0 -52
karrio/core/models.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
"""Karrio Unified model definitions module."""
|
2
|
+
|
3
|
+
from unicodedata import category
|
2
4
|
import attr
|
3
5
|
from typing import List, Dict, Any, Union
|
4
6
|
from jstruct import JList, JStruct, REQUIRED
|
@@ -44,6 +46,7 @@ class Commodity:
|
|
44
46
|
value_amount: float = None
|
45
47
|
value_currency: str = None
|
46
48
|
origin_country: str = None
|
49
|
+
category: str = None
|
47
50
|
|
48
51
|
metadata: Dict = {}
|
49
52
|
|
@@ -125,6 +128,7 @@ class ShipmentRequest:
|
|
125
128
|
|
126
129
|
payment: Payment = JStruct[Payment]
|
127
130
|
customs: Customs = JStruct[Customs]
|
131
|
+
return_address: Address = JStruct[Address]
|
128
132
|
billing_address: Address = JStruct[Address]
|
129
133
|
|
130
134
|
options: Dict = {}
|
@@ -152,6 +156,11 @@ class RateRequest:
|
|
152
156
|
recipient: Address = JStruct[Address, REQUIRED]
|
153
157
|
parcels: List[Parcel] = JList[Parcel, REQUIRED]
|
154
158
|
|
159
|
+
payment: Payment = JStruct[Payment]
|
160
|
+
customs: Customs = JStruct[Customs]
|
161
|
+
return_address: Address = JStruct[Address]
|
162
|
+
billing_address: Address = JStruct[Address]
|
163
|
+
|
155
164
|
services: List[str] = []
|
156
165
|
options: Dict = {}
|
157
166
|
reference: str = ""
|
@@ -177,10 +186,13 @@ class PickupRequest:
|
|
177
186
|
address: Address = JStruct[Address, REQUIRED]
|
178
187
|
|
179
188
|
parcels: List[Parcel] = JList[Parcel]
|
180
|
-
|
189
|
+
shipment_identifiers: List[str] = []
|
181
190
|
package_location: str = None
|
191
|
+
instruction: str = None
|
182
192
|
options: Dict = {}
|
183
193
|
|
194
|
+
metadata: Dict = {}
|
195
|
+
|
184
196
|
|
185
197
|
@attr.s(auto_attribs=True)
|
186
198
|
class PickupUpdateRequest:
|
@@ -193,8 +205,9 @@ class PickupUpdateRequest:
|
|
193
205
|
address: Address = JStruct[Address, REQUIRED]
|
194
206
|
|
195
207
|
parcels: List[Parcel] = JList[Parcel]
|
196
|
-
|
208
|
+
shipment_identifiers: List[str] = []
|
197
209
|
package_location: str = None
|
210
|
+
instruction: str = None
|
198
211
|
options: Dict = {}
|
199
212
|
|
200
213
|
|
@@ -207,6 +220,7 @@ class PickupCancelRequest:
|
|
207
220
|
address: Address = JStruct[Address]
|
208
221
|
pickup_date: str = None
|
209
222
|
reason: str = None
|
223
|
+
options: Dict = {}
|
210
224
|
|
211
225
|
|
212
226
|
@attr.s(auto_attribs=True)
|
@@ -216,6 +230,18 @@ class AddressValidationRequest:
|
|
216
230
|
address: Address = JStruct[Address, REQUIRED]
|
217
231
|
|
218
232
|
|
233
|
+
@attr.s(auto_attribs=True)
|
234
|
+
class ManifestRequest:
|
235
|
+
"""manifest request unified data type."""
|
236
|
+
|
237
|
+
shipment_identifiers: List[str]
|
238
|
+
address: Address = JStruct[Address, REQUIRED]
|
239
|
+
|
240
|
+
reference: str = None
|
241
|
+
metadata: Dict = {}
|
242
|
+
options: Dict = {}
|
243
|
+
|
244
|
+
|
219
245
|
@attr.s(auto_attribs=True)
|
220
246
|
class Message:
|
221
247
|
"""Karrio unified Message data type."""
|
@@ -224,6 +250,7 @@ class Message:
|
|
224
250
|
carrier_id: str
|
225
251
|
message: Union[str, Any] = None
|
226
252
|
code: str = None
|
253
|
+
level: str = None
|
227
254
|
details: Dict = None
|
228
255
|
|
229
256
|
|
@@ -302,6 +329,14 @@ class TrackingInfo:
|
|
302
329
|
source: str = None
|
303
330
|
|
304
331
|
|
332
|
+
@attr.s(auto_attribs=True)
|
333
|
+
class Images:
|
334
|
+
"""Karrio unified tracker images data type."""
|
335
|
+
|
336
|
+
delivery_image: str = None
|
337
|
+
signature_image: str = None
|
338
|
+
|
339
|
+
|
305
340
|
@attr.s(auto_attribs=True)
|
306
341
|
class TrackingDetails:
|
307
342
|
"""Karrio unified tracking details data type."""
|
@@ -310,6 +345,7 @@ class TrackingDetails:
|
|
310
345
|
carrier_id: str
|
311
346
|
tracking_number: str
|
312
347
|
events: List[TrackingEvent] = JList[TrackingEvent, REQUIRED]
|
348
|
+
images: Images = JStruct[Images]
|
313
349
|
estimated_delivery: str = None
|
314
350
|
info: TrackingInfo = None
|
315
351
|
delivered: bool = None
|
@@ -319,13 +355,13 @@ class TrackingDetails:
|
|
319
355
|
|
320
356
|
@attr.s(auto_attribs=True)
|
321
357
|
class Documents:
|
322
|
-
"""Karrio unified shipment details data type."""
|
358
|
+
"""Karrio unified shipment documents details data type."""
|
323
359
|
|
324
360
|
label: str
|
325
|
-
zpl_label: str = None
|
326
|
-
pdf_label: str = None
|
327
361
|
|
328
362
|
invoice: str = None
|
363
|
+
zpl_label: str = None
|
364
|
+
pdf_label: str = None
|
329
365
|
|
330
366
|
|
331
367
|
@attr.s(auto_attribs=True)
|
@@ -354,6 +390,25 @@ class PickupDetails:
|
|
354
390
|
pickup_charge: ChargeDetails = JStruct[ChargeDetails]
|
355
391
|
ready_time: str = None
|
356
392
|
closing_time: str = None
|
393
|
+
meta: dict = None
|
394
|
+
id: str = None
|
395
|
+
|
396
|
+
|
397
|
+
@attr.s(auto_attribs=True)
|
398
|
+
class ManifestDocument:
|
399
|
+
"""Karrio unified manifest document details data type."""
|
400
|
+
|
401
|
+
manifest: str = None
|
402
|
+
|
403
|
+
|
404
|
+
@attr.s(auto_attribs=True)
|
405
|
+
class ManifestDetails:
|
406
|
+
"""Karrio unified manifest details data type."""
|
407
|
+
|
408
|
+
carrier_name: str
|
409
|
+
carrier_id: str
|
410
|
+
doc: ManifestDocument = JStruct[ManifestDocument]
|
411
|
+
meta: dict = None
|
357
412
|
id: str = None
|
358
413
|
|
359
414
|
|
@@ -390,6 +445,7 @@ class ServiceZone:
|
|
390
445
|
|
391
446
|
# Location
|
392
447
|
cities: List[str] = []
|
448
|
+
postal_codes: List[str] = []
|
393
449
|
country_codes: List[str] = []
|
394
450
|
|
395
451
|
|
@@ -399,6 +455,7 @@ class ServiceLevel:
|
|
399
455
|
|
400
456
|
service_name: str
|
401
457
|
service_code: str
|
458
|
+
carrier_service_code: str = None
|
402
459
|
description: str = ""
|
403
460
|
active: bool = True
|
404
461
|
id: str = None
|
@@ -426,6 +483,8 @@ class ServiceLevel:
|
|
426
483
|
transit_days: int = None
|
427
484
|
transit_time: float = None
|
428
485
|
|
486
|
+
metadata: Dict = {}
|
487
|
+
|
429
488
|
|
430
489
|
@attr.s(auto_attribs=True)
|
431
490
|
class LabelTemplate:
|