karrio-server-core 2025.5rc9__py3-none-any.whl → 2025.5rc11__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.

Potentially problematic release.


This version of karrio-server-core might be problematic. Click here for more details.

@@ -174,9 +174,7 @@ class Shipments:
174
174
 
175
175
  # The request is wrapped in utils.identity to simplify mocking in tests.
176
176
  shipment, messages = utils.identity(
177
- lambda: karrio.Shipment.create(request)
178
- .from_(carrier.gateway)
179
- .parse()
177
+ lambda: karrio.Shipment.create(request).from_(carrier.gateway).parse()
180
178
  )
181
179
 
182
180
  if shipment is None:
@@ -202,19 +200,35 @@ class Shipments:
202
200
  }
203
201
 
204
202
  def process_selected_rate() -> dict:
203
+ estimated_delivery = lib.failsafe(
204
+ lambda: (
205
+ getattr(shipment.selected_rate, "estimated_delivery", None)
206
+ or getattr(selected_rate, "estimated_delivery", None)
207
+ )
208
+ )
209
+ transit_days = lib.failsafe(
210
+ lambda: (
211
+ getattr(shipment.selected_rate, "transit_days", None)
212
+ or getattr(selected_rate, "transit_days", None)
213
+ )
214
+ )
205
215
  rate = lib.identity(
206
216
  {
207
217
  **lib.to_dict(shipment.selected_rate),
208
218
  "id": f"rat_{uuid.uuid4().hex}",
209
219
  "test_mode": carrier.test_mode,
220
+ "estimated_delivery": estimated_delivery,
221
+ "transit_days": transit_days,
210
222
  }
211
223
  if shipment.selected_rate is not None
212
224
  else lib.to_dict(selected_rate)
213
225
  )
214
- return lib.to_dict({
215
- **rate,
216
- "meta": process_meta(shipment.selected_rate or selected_rate),
217
- })
226
+ return lib.to_dict(
227
+ {
228
+ **rate,
229
+ "meta": process_meta(shipment.selected_rate or selected_rate),
230
+ }
231
+ )
218
232
 
219
233
  def process_tracking_url(rate: datatypes.Rate) -> str:
220
234
  rate_provider = (rate.get("meta") or {}).get("rate_provider")
@@ -263,7 +277,9 @@ class Shipments:
263
277
  "parcels": process_parcel_refs(payload["parcels"]),
264
278
  "tracking_url": process_tracking_url(shipment_rate),
265
279
  "status": serializers.ShipmentStatus.purchased.value,
266
- "created_at": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f%z"),
280
+ "created_at": datetime.datetime.now().strftime(
281
+ "%Y-%m-%d %H:%M:%S.%f%z"
282
+ ),
267
283
  "meta": process_meta(shipment),
268
284
  "messages": messages,
269
285
  },
@@ -12,7 +12,9 @@ class Entity(models.Model):
12
12
  updated_at = models.DateTimeField(auto_now=True)
13
13
 
14
14
  def __str__(self):
15
- return self.id
15
+ return (
16
+ str(self.id) if self.id is not None else f"{self.__class__.__name__}(None)"
17
+ )
16
18
 
17
19
 
18
20
  class OwnedEntity(ControlledAccessModel, Entity):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: karrio_server_core
3
- Version: 2025.5rc9
3
+ Version: 2025.5rc11
4
4
  Summary: Multi-carrier shipping API Core module
5
5
  Author-email: karrio <hello@karrio.io>
6
6
  License-Expression: Apache-2.0
@@ -11,7 +11,7 @@ karrio/server/core/dataunits.py,sha256=Mbmh6Bi9CwlxdAYLIfLlQjxCSZd_uWN0Dux-GIYTr
11
11
  karrio/server/core/exceptions.py,sha256=AR4FNT_1wkMkuv_ZELB9pVRL3RRWsSJ7hrNgBP7H3EU,6038
12
12
  karrio/server/core/fields.py,sha256=5i5eetbxFkIQ9uoFk8k2xPl1mXXnaVKlPV4xwlF3inY,345
13
13
  karrio/server/core/filters.py,sha256=nHj742vPWE3Xs_tpwRRVUh00OwxnF22xKfIK7rx-sw4,27434
14
- karrio/server/core/gateway.py,sha256=7hCIvgLbqdQcwRr6eIufXCbQ485pmKMFerh9rLHaIGg,25081
14
+ karrio/server/core/gateway.py,sha256=TH3-RIxZ2BUrteyDAXWxH_GvY4pC4A_l7t-pRbLDO-M,25747
15
15
  karrio/server/core/middleware.py,sha256=euRkeIvNv3G-b_U3fKDO6po-2dbYF0LiXUYg2nyeCI0,3017
16
16
  karrio/server/core/oauth_validators.py,sha256=5JxDkXB_HX4a4xJltZcFGukO7o2cUl9h2t9O8Gp87Zc,6673
17
17
  karrio/server/core/permissions.py,sha256=JY3_hTEnyDTWG-weAWPx8xMoaRZwpNL2HaSssBzjH7Y,1189
@@ -33,7 +33,7 @@ karrio/server/core/migrations/0005_alter_metafield_type_alter_metafield_value.py
33
33
  karrio/server/core/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  karrio/server/core/models/__init__.py,sha256=iw1pwHhXpWru5AnLimWzH3mouad9-GTrYTWsmZOC6hU,1176
35
35
  karrio/server/core/models/base.py,sha256=pRdm0GIOdGZCrxj-U6cZGTFp4KJuOQhCGtiZNJF1qiE,1785
36
- karrio/server/core/models/entity.py,sha256=skA74F0YPxoZsJliL8lqRaetjX2WzS5aLIONAwnmQ6E,630
36
+ karrio/server/core/models/entity.py,sha256=cUSIzv84RIPif2DdNSScY7RHuHgXufwIF8YNZ8BYC1g,722
37
37
  karrio/server/core/models/metafield.py,sha256=etzJ1BS98Ipe3mxJuDOK3-c36Z2oZKgnPaHQmYta2Dw,5048
38
38
  karrio/server/core/models/third_party.py,sha256=iNXvcq0pJN2gFu5Bu03k6FMdQNxEhzoijIhl4lc7JmU,552
39
39
  karrio/server/core/views/__init__.py,sha256=jvhomX2_aiPcfdUjq7_kzp5rOerLwScnbRNDqs751Zo,88
@@ -235,7 +235,7 @@ karrio/server/user/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
235
235
  karrio/server/user/templates/registration/login.html,sha256=3_tj-0rKfwkCk-fp_GT8xFQhLqjGcJs3uZzOAaI40Sw,3690
236
236
  karrio/server/user/templates/registration/registration_confirm_email.html,sha256=zFDkNN_BHMQyrBv_mU8aoqXxYxG91TGuf6pKwRa5jxE,247
237
237
  karrio/server/user/templates/registration/registration_confirm_email.txt,sha256=I_zN_pJTRigfyiYbyQK0wFfrI5Zq1JG8lf0TyLA9fN0,94
238
- karrio_server_core-2025.5rc9.dist-info/METADATA,sha256=YOlpmYF2Id7UgTB2MkQVxNJnAk_q3K4swzmEAY5veYI,796
239
- karrio_server_core-2025.5rc9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
240
- karrio_server_core-2025.5rc9.dist-info/top_level.txt,sha256=D1D7x8R3cTfjF_15mfiO7wCQ5QMtuM4x8GaPr7z5i78,12
241
- karrio_server_core-2025.5rc9.dist-info/RECORD,,
238
+ karrio_server_core-2025.5rc11.dist-info/METADATA,sha256=vgYoK-0D6VP6I2f74PIbJw5kQ79B6Gi79Yo4iLqFajg,797
239
+ karrio_server_core-2025.5rc11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
240
+ karrio_server_core-2025.5rc11.dist-info/top_level.txt,sha256=D1D7x8R3cTfjF_15mfiO7wCQ5QMtuM4x8GaPr7z5i78,12
241
+ karrio_server_core-2025.5rc11.dist-info/RECORD,,