karrio-sapient 2025.5rc33__py3-none-any.whl → 2025.5rc35__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.
@@ -92,7 +92,14 @@ def login(settings: Settings):
92
92
  on_error=parse_error_response,
93
93
  )
94
94
 
95
- response = lib.to_dict(result)
95
+ # Handle case where result is a plain string (error response)
96
+ # instead of JSON - parse_error_response may return non-JSON strings
97
+ response = lib.failsafe(lambda: lib.to_dict(result)) or {}
98
+
99
+ # If we couldn't parse as JSON, treat the result as an error message
100
+ if not response and isinstance(result, str):
101
+ response = {"error": result}
102
+
96
103
  messages = error.parse_error_response(response, settings)
97
104
 
98
105
  if any(messages):
@@ -114,9 +121,11 @@ def parse_error_response(response):
114
121
  """Parse the error response from the SAPIENT API."""
115
122
  content = lib.failsafe(lambda: lib.decode(response.read()))
116
123
 
124
+ # If we have content, try to return it as-is (likely already JSON string)
117
125
  if any(content or ""):
118
126
  return content
119
127
 
128
+ # If no content, create a JSON error object
120
129
  return lib.to_json(
121
130
  dict(Errors=[dict(ErrorCode=str(response.code), Message=response.reason)])
122
131
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: karrio_sapient
3
- Version: 2025.5rc33
3
+ Version: 2025.5rc35
4
4
  Summary: Karrio - SAPIENT Shipping Extension
5
5
  Author-email: karrio <hello@karrio.io>
6
6
  License-Expression: Apache-2.0
@@ -6,7 +6,7 @@ karrio/plugins/sapient/__init__.py,sha256=_4xkqTPpUoq8KixCdNqNxcMVH52s5xH6L-s9c5
6
6
  karrio/providers/sapient/__init__.py,sha256=Zu7FIaPsCzXgIsrmEtluHQJSj3UnFDpz-oiB93P-xK0,476
7
7
  karrio/providers/sapient/error.py,sha256=hkpy86gWOjKLNhtmBoe7NkHq330kRqrtgDxsspLaxGQ,870
8
8
  karrio/providers/sapient/units.py,sha256=ZUGl0IVKOA8vLVRWJGY2X9JBOR8H5OBr9s17Fx22EcM,34880
9
- karrio/providers/sapient/utils.py,sha256=31dgSqot8k3gj_kpUfitKMrUQtuNtVzkzEW_cAKRkUQ,3763
9
+ karrio/providers/sapient/utils.py,sha256=RJSzGtiGd2YtLgvibD3kQh1toUeEvVyzGnBB_QmsFL8,4217
10
10
  karrio/providers/sapient/pickup/__init__.py,sha256=qT64wGr8J6pkLNa9Y0Zou5mYshoI7W-R0Pp7nWEhQ08,296
11
11
  karrio/providers/sapient/pickup/cancel.py,sha256=0laDCfdhjOYHpOEN7l6u1o79nexaxT8GXMM5pJU3Xow,1763
12
12
  karrio/providers/sapient/pickup/create.py,sha256=5S-h9qQuDFqxvqrmd2l0-SGQMi86O38sfjfqRVPGgo8,2776
@@ -20,8 +20,8 @@ karrio/schemas/sapient/pickup_request.py,sha256=gzZZ3Bxr_pYWxw28vDRr-aDgtzJIQptU
20
20
  karrio/schemas/sapient/pickup_response.py,sha256=xcl3ofB2L2RNksMSRccvFbBdBcK1hVDDPVB-oAu4I54,195
21
21
  karrio/schemas/sapient/shipment_requests.py,sha256=3sjensnLiiF7mTIpwS4FyrdEe-xMh5YC1ekj69qI6XM,4618
22
22
  karrio/schemas/sapient/shipment_response.py,sha256=457ULt-exxAJ0Drqn2Pnj9pl_4JWMZ-cesuJW9NWBAs,702
23
- karrio_sapient-2025.5rc33.dist-info/METADATA,sha256=CbF3dq_zK5RGFI_omFtejYaNcUP9NleLLP1jnHDUNAg,993
24
- karrio_sapient-2025.5rc33.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- karrio_sapient-2025.5rc33.dist-info/entry_points.txt,sha256=rPF-WjVKk-3suhX4-zi9hTkwr0Qxb4ZW-Tjoyzi_Cy8,59
26
- karrio_sapient-2025.5rc33.dist-info/top_level.txt,sha256=FZCY8Nwft8oEGHdl--xku8P3TrnOxu5dETEU_fWpRSM,20
27
- karrio_sapient-2025.5rc33.dist-info/RECORD,,
23
+ karrio_sapient-2025.5rc35.dist-info/METADATA,sha256=DbIxB7eaQPLhytMbpE6nbKxr6A0XLhg099MJe1akrJk,993
24
+ karrio_sapient-2025.5rc35.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ karrio_sapient-2025.5rc35.dist-info/entry_points.txt,sha256=rPF-WjVKk-3suhX4-zi9hTkwr0Qxb4ZW-Tjoyzi_Cy8,59
26
+ karrio_sapient-2025.5rc35.dist-info/top_level.txt,sha256=FZCY8Nwft8oEGHdl--xku8P3TrnOxu5dETEU_fWpRSM,20
27
+ karrio_sapient-2025.5rc35.dist-info/RECORD,,