compass_api_sdk 0.9.35__py3-none-any.whl → 0.9.37__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 compass_api_sdk might be problematic. Click here for more details.

@@ -91,33 +91,22 @@ class AerodromeSlipstream(BaseSDK):
91
91
 
92
92
  response_data: Any = None
93
93
  if utils.match_response(http_res, "200", "application/json"):
94
- return utils.unmarshal_json(
95
- http_res.text, models.AerodromeLPPositionsResponse
94
+ return utils.unmarshal_json_response(
95
+ models.AerodromeLPPositionsResponse, http_res
96
96
  )
97
97
  if utils.match_response(http_res, "422", "application/json"):
98
- response_data = utils.unmarshal_json(
99
- http_res.text, errors.HTTPValidationErrorData
98
+ response_data = utils.unmarshal_json_response(
99
+ errors.HTTPValidationErrorData, http_res
100
100
  )
101
- raise errors.HTTPValidationError(data=response_data)
101
+ raise errors.HTTPValidationError(response_data, http_res)
102
102
  if utils.match_response(http_res, "4XX", "*"):
103
103
  http_res_text = utils.stream_to_text(http_res)
104
- raise errors.APIError(
105
- "API error occurred", http_res.status_code, http_res_text, http_res
106
- )
104
+ raise errors.APIError("API error occurred", http_res, http_res_text)
107
105
  if utils.match_response(http_res, "5XX", "*"):
108
106
  http_res_text = utils.stream_to_text(http_res)
109
- raise errors.APIError(
110
- "API error occurred", http_res.status_code, http_res_text, http_res
111
- )
107
+ raise errors.APIError("API error occurred", http_res, http_res_text)
112
108
 
113
- content_type = http_res.headers.get("Content-Type")
114
- http_res_text = utils.stream_to_text(http_res)
115
- raise errors.APIError(
116
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
117
- http_res.status_code,
118
- http_res_text,
119
- http_res,
120
- )
109
+ raise errors.APIError("Unexpected response received", http_res)
121
110
 
122
111
  async def slipstream_liquidity_provision_positions_async(
123
112
  self,
@@ -202,33 +191,22 @@ class AerodromeSlipstream(BaseSDK):
202
191
 
203
192
  response_data: Any = None
204
193
  if utils.match_response(http_res, "200", "application/json"):
205
- return utils.unmarshal_json(
206
- http_res.text, models.AerodromeLPPositionsResponse
194
+ return utils.unmarshal_json_response(
195
+ models.AerodromeLPPositionsResponse, http_res
207
196
  )
208
197
  if utils.match_response(http_res, "422", "application/json"):
209
- response_data = utils.unmarshal_json(
210
- http_res.text, errors.HTTPValidationErrorData
198
+ response_data = utils.unmarshal_json_response(
199
+ errors.HTTPValidationErrorData, http_res
211
200
  )
212
- raise errors.HTTPValidationError(data=response_data)
201
+ raise errors.HTTPValidationError(response_data, http_res)
213
202
  if utils.match_response(http_res, "4XX", "*"):
214
203
  http_res_text = await utils.stream_to_text_async(http_res)
215
- raise errors.APIError(
216
- "API error occurred", http_res.status_code, http_res_text, http_res
217
- )
204
+ raise errors.APIError("API error occurred", http_res, http_res_text)
218
205
  if utils.match_response(http_res, "5XX", "*"):
219
206
  http_res_text = await utils.stream_to_text_async(http_res)
220
- raise errors.APIError(
221
- "API error occurred", http_res.status_code, http_res_text, http_res
222
- )
207
+ raise errors.APIError("API error occurred", http_res, http_res_text)
223
208
 
224
- content_type = http_res.headers.get("Content-Type")
225
- http_res_text = await utils.stream_to_text_async(http_res)
226
- raise errors.APIError(
227
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
228
- http_res.status_code,
229
- http_res_text,
230
- http_res,
231
- )
209
+ raise errors.APIError("Unexpected response received", http_res)
232
210
 
233
211
  def slipstream_pool_price(
234
212
  self,
@@ -316,33 +294,22 @@ class AerodromeSlipstream(BaseSDK):
316
294
 
317
295
  response_data: Any = None
318
296
  if utils.match_response(http_res, "200", "application/json"):
319
- return utils.unmarshal_json(
320
- http_res.text, models.AerodromeSlipstreamPoolPriceResponse
297
+ return utils.unmarshal_json_response(
298
+ models.AerodromeSlipstreamPoolPriceResponse, http_res
321
299
  )
322
300
  if utils.match_response(http_res, "422", "application/json"):
323
- response_data = utils.unmarshal_json(
324
- http_res.text, errors.HTTPValidationErrorData
301
+ response_data = utils.unmarshal_json_response(
302
+ errors.HTTPValidationErrorData, http_res
325
303
  )
326
- raise errors.HTTPValidationError(data=response_data)
304
+ raise errors.HTTPValidationError(response_data, http_res)
327
305
  if utils.match_response(http_res, "4XX", "*"):
328
306
  http_res_text = utils.stream_to_text(http_res)
329
- raise errors.APIError(
330
- "API error occurred", http_res.status_code, http_res_text, http_res
331
- )
307
+ raise errors.APIError("API error occurred", http_res, http_res_text)
332
308
  if utils.match_response(http_res, "5XX", "*"):
333
309
  http_res_text = utils.stream_to_text(http_res)
334
- raise errors.APIError(
335
- "API error occurred", http_res.status_code, http_res_text, http_res
336
- )
310
+ raise errors.APIError("API error occurred", http_res, http_res_text)
337
311
 
338
- content_type = http_res.headers.get("Content-Type")
339
- http_res_text = utils.stream_to_text(http_res)
340
- raise errors.APIError(
341
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
342
- http_res.status_code,
343
- http_res_text,
344
- http_res,
345
- )
312
+ raise errors.APIError("Unexpected response received", http_res)
346
313
 
347
314
  async def slipstream_pool_price_async(
348
315
  self,
@@ -430,33 +397,22 @@ class AerodromeSlipstream(BaseSDK):
430
397
 
431
398
  response_data: Any = None
432
399
  if utils.match_response(http_res, "200", "application/json"):
433
- return utils.unmarshal_json(
434
- http_res.text, models.AerodromeSlipstreamPoolPriceResponse
400
+ return utils.unmarshal_json_response(
401
+ models.AerodromeSlipstreamPoolPriceResponse, http_res
435
402
  )
436
403
  if utils.match_response(http_res, "422", "application/json"):
437
- response_data = utils.unmarshal_json(
438
- http_res.text, errors.HTTPValidationErrorData
404
+ response_data = utils.unmarshal_json_response(
405
+ errors.HTTPValidationErrorData, http_res
439
406
  )
440
- raise errors.HTTPValidationError(data=response_data)
407
+ raise errors.HTTPValidationError(response_data, http_res)
441
408
  if utils.match_response(http_res, "4XX", "*"):
442
409
  http_res_text = await utils.stream_to_text_async(http_res)
443
- raise errors.APIError(
444
- "API error occurred", http_res.status_code, http_res_text, http_res
445
- )
410
+ raise errors.APIError("API error occurred", http_res, http_res_text)
446
411
  if utils.match_response(http_res, "5XX", "*"):
447
412
  http_res_text = await utils.stream_to_text_async(http_res)
448
- raise errors.APIError(
449
- "API error occurred", http_res.status_code, http_res_text, http_res
450
- )
413
+ raise errors.APIError("API error occurred", http_res, http_res_text)
451
414
 
452
- content_type = http_res.headers.get("Content-Type")
453
- http_res_text = await utils.stream_to_text_async(http_res)
454
- raise errors.APIError(
455
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
456
- http_res.status_code,
457
- http_res_text,
458
- http_res,
459
- )
415
+ raise errors.APIError("Unexpected response received", http_res)
460
416
 
461
417
  def slipstream_swap_sell_exactly(
462
418
  self,
@@ -571,31 +527,20 @@ class AerodromeSlipstream(BaseSDK):
571
527
 
572
528
  response_data: Any = None
573
529
  if utils.match_response(http_res, "200", "application/json"):
574
- return utils.unmarshal_json(http_res.text, models.TxResponse)
530
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
575
531
  if utils.match_response(http_res, "422", "application/json"):
576
- response_data = utils.unmarshal_json(
577
- http_res.text, errors.HTTPValidationErrorData
532
+ response_data = utils.unmarshal_json_response(
533
+ errors.HTTPValidationErrorData, http_res
578
534
  )
579
- raise errors.HTTPValidationError(data=response_data)
535
+ raise errors.HTTPValidationError(response_data, http_res)
580
536
  if utils.match_response(http_res, "4XX", "*"):
581
537
  http_res_text = utils.stream_to_text(http_res)
582
- raise errors.APIError(
583
- "API error occurred", http_res.status_code, http_res_text, http_res
584
- )
538
+ raise errors.APIError("API error occurred", http_res, http_res_text)
585
539
  if utils.match_response(http_res, "5XX", "*"):
586
540
  http_res_text = utils.stream_to_text(http_res)
587
- raise errors.APIError(
588
- "API error occurred", http_res.status_code, http_res_text, http_res
589
- )
541
+ raise errors.APIError("API error occurred", http_res, http_res_text)
590
542
 
591
- content_type = http_res.headers.get("Content-Type")
592
- http_res_text = utils.stream_to_text(http_res)
593
- raise errors.APIError(
594
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
595
- http_res.status_code,
596
- http_res_text,
597
- http_res,
598
- )
543
+ raise errors.APIError("Unexpected response received", http_res)
599
544
 
600
545
  async def slipstream_swap_sell_exactly_async(
601
546
  self,
@@ -710,31 +655,20 @@ class AerodromeSlipstream(BaseSDK):
710
655
 
711
656
  response_data: Any = None
712
657
  if utils.match_response(http_res, "200", "application/json"):
713
- return utils.unmarshal_json(http_res.text, models.TxResponse)
658
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
714
659
  if utils.match_response(http_res, "422", "application/json"):
715
- response_data = utils.unmarshal_json(
716
- http_res.text, errors.HTTPValidationErrorData
660
+ response_data = utils.unmarshal_json_response(
661
+ errors.HTTPValidationErrorData, http_res
717
662
  )
718
- raise errors.HTTPValidationError(data=response_data)
663
+ raise errors.HTTPValidationError(response_data, http_res)
719
664
  if utils.match_response(http_res, "4XX", "*"):
720
665
  http_res_text = await utils.stream_to_text_async(http_res)
721
- raise errors.APIError(
722
- "API error occurred", http_res.status_code, http_res_text, http_res
723
- )
666
+ raise errors.APIError("API error occurred", http_res, http_res_text)
724
667
  if utils.match_response(http_res, "5XX", "*"):
725
668
  http_res_text = await utils.stream_to_text_async(http_res)
726
- raise errors.APIError(
727
- "API error occurred", http_res.status_code, http_res_text, http_res
728
- )
669
+ raise errors.APIError("API error occurred", http_res, http_res_text)
729
670
 
730
- content_type = http_res.headers.get("Content-Type")
731
- http_res_text = await utils.stream_to_text_async(http_res)
732
- raise errors.APIError(
733
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
734
- http_res.status_code,
735
- http_res_text,
736
- http_res,
737
- )
671
+ raise errors.APIError("Unexpected response received", http_res)
738
672
 
739
673
  def slipstream_swap_buy_exactly(
740
674
  self,
@@ -848,31 +782,20 @@ class AerodromeSlipstream(BaseSDK):
848
782
 
849
783
  response_data: Any = None
850
784
  if utils.match_response(http_res, "200", "application/json"):
851
- return utils.unmarshal_json(http_res.text, models.TxResponse)
785
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
852
786
  if utils.match_response(http_res, "422", "application/json"):
853
- response_data = utils.unmarshal_json(
854
- http_res.text, errors.HTTPValidationErrorData
787
+ response_data = utils.unmarshal_json_response(
788
+ errors.HTTPValidationErrorData, http_res
855
789
  )
856
- raise errors.HTTPValidationError(data=response_data)
790
+ raise errors.HTTPValidationError(response_data, http_res)
857
791
  if utils.match_response(http_res, "4XX", "*"):
858
792
  http_res_text = utils.stream_to_text(http_res)
859
- raise errors.APIError(
860
- "API error occurred", http_res.status_code, http_res_text, http_res
861
- )
793
+ raise errors.APIError("API error occurred", http_res, http_res_text)
862
794
  if utils.match_response(http_res, "5XX", "*"):
863
795
  http_res_text = utils.stream_to_text(http_res)
864
- raise errors.APIError(
865
- "API error occurred", http_res.status_code, http_res_text, http_res
866
- )
796
+ raise errors.APIError("API error occurred", http_res, http_res_text)
867
797
 
868
- content_type = http_res.headers.get("Content-Type")
869
- http_res_text = utils.stream_to_text(http_res)
870
- raise errors.APIError(
871
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
872
- http_res.status_code,
873
- http_res_text,
874
- http_res,
875
- )
798
+ raise errors.APIError("Unexpected response received", http_res)
876
799
 
877
800
  async def slipstream_swap_buy_exactly_async(
878
801
  self,
@@ -986,31 +909,20 @@ class AerodromeSlipstream(BaseSDK):
986
909
 
987
910
  response_data: Any = None
988
911
  if utils.match_response(http_res, "200", "application/json"):
989
- return utils.unmarshal_json(http_res.text, models.TxResponse)
912
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
990
913
  if utils.match_response(http_res, "422", "application/json"):
991
- response_data = utils.unmarshal_json(
992
- http_res.text, errors.HTTPValidationErrorData
914
+ response_data = utils.unmarshal_json_response(
915
+ errors.HTTPValidationErrorData, http_res
993
916
  )
994
- raise errors.HTTPValidationError(data=response_data)
917
+ raise errors.HTTPValidationError(response_data, http_res)
995
918
  if utils.match_response(http_res, "4XX", "*"):
996
919
  http_res_text = await utils.stream_to_text_async(http_res)
997
- raise errors.APIError(
998
- "API error occurred", http_res.status_code, http_res_text, http_res
999
- )
920
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1000
921
  if utils.match_response(http_res, "5XX", "*"):
1001
922
  http_res_text = await utils.stream_to_text_async(http_res)
1002
- raise errors.APIError(
1003
- "API error occurred", http_res.status_code, http_res_text, http_res
1004
- )
923
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1005
924
 
1006
- content_type = http_res.headers.get("Content-Type")
1007
- http_res_text = await utils.stream_to_text_async(http_res)
1008
- raise errors.APIError(
1009
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1010
- http_res.status_code,
1011
- http_res_text,
1012
- http_res,
1013
- )
925
+ raise errors.APIError("Unexpected response received", http_res)
1014
926
 
1015
927
  def slipstream_liquidity_provision_mint(
1016
928
  self,
@@ -1144,31 +1056,20 @@ class AerodromeSlipstream(BaseSDK):
1144
1056
 
1145
1057
  response_data: Any = None
1146
1058
  if utils.match_response(http_res, "200", "application/json"):
1147
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1059
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1148
1060
  if utils.match_response(http_res, "422", "application/json"):
1149
- response_data = utils.unmarshal_json(
1150
- http_res.text, errors.HTTPValidationErrorData
1061
+ response_data = utils.unmarshal_json_response(
1062
+ errors.HTTPValidationErrorData, http_res
1151
1063
  )
1152
- raise errors.HTTPValidationError(data=response_data)
1064
+ raise errors.HTTPValidationError(response_data, http_res)
1153
1065
  if utils.match_response(http_res, "4XX", "*"):
1154
1066
  http_res_text = utils.stream_to_text(http_res)
1155
- raise errors.APIError(
1156
- "API error occurred", http_res.status_code, http_res_text, http_res
1157
- )
1067
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1158
1068
  if utils.match_response(http_res, "5XX", "*"):
1159
1069
  http_res_text = utils.stream_to_text(http_res)
1160
- raise errors.APIError(
1161
- "API error occurred", http_res.status_code, http_res_text, http_res
1162
- )
1070
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1163
1071
 
1164
- content_type = http_res.headers.get("Content-Type")
1165
- http_res_text = utils.stream_to_text(http_res)
1166
- raise errors.APIError(
1167
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1168
- http_res.status_code,
1169
- http_res_text,
1170
- http_res,
1171
- )
1072
+ raise errors.APIError("Unexpected response received", http_res)
1172
1073
 
1173
1074
  async def slipstream_liquidity_provision_mint_async(
1174
1075
  self,
@@ -1302,31 +1203,20 @@ class AerodromeSlipstream(BaseSDK):
1302
1203
 
1303
1204
  response_data: Any = None
1304
1205
  if utils.match_response(http_res, "200", "application/json"):
1305
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1206
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1306
1207
  if utils.match_response(http_res, "422", "application/json"):
1307
- response_data = utils.unmarshal_json(
1308
- http_res.text, errors.HTTPValidationErrorData
1208
+ response_data = utils.unmarshal_json_response(
1209
+ errors.HTTPValidationErrorData, http_res
1309
1210
  )
1310
- raise errors.HTTPValidationError(data=response_data)
1211
+ raise errors.HTTPValidationError(response_data, http_res)
1311
1212
  if utils.match_response(http_res, "4XX", "*"):
1312
1213
  http_res_text = await utils.stream_to_text_async(http_res)
1313
- raise errors.APIError(
1314
- "API error occurred", http_res.status_code, http_res_text, http_res
1315
- )
1214
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1316
1215
  if utils.match_response(http_res, "5XX", "*"):
1317
1216
  http_res_text = await utils.stream_to_text_async(http_res)
1318
- raise errors.APIError(
1319
- "API error occurred", http_res.status_code, http_res_text, http_res
1320
- )
1217
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1321
1218
 
1322
- content_type = http_res.headers.get("Content-Type")
1323
- http_res_text = await utils.stream_to_text_async(http_res)
1324
- raise errors.APIError(
1325
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1326
- http_res.status_code,
1327
- http_res_text,
1328
- http_res,
1329
- )
1219
+ raise errors.APIError("Unexpected response received", http_res)
1330
1220
 
1331
1221
  def slipstream_liquidity_provision_increase(
1332
1222
  self,
@@ -1447,31 +1337,20 @@ class AerodromeSlipstream(BaseSDK):
1447
1337
 
1448
1338
  response_data: Any = None
1449
1339
  if utils.match_response(http_res, "200", "application/json"):
1450
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1340
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1451
1341
  if utils.match_response(http_res, "422", "application/json"):
1452
- response_data = utils.unmarshal_json(
1453
- http_res.text, errors.HTTPValidationErrorData
1342
+ response_data = utils.unmarshal_json_response(
1343
+ errors.HTTPValidationErrorData, http_res
1454
1344
  )
1455
- raise errors.HTTPValidationError(data=response_data)
1345
+ raise errors.HTTPValidationError(response_data, http_res)
1456
1346
  if utils.match_response(http_res, "4XX", "*"):
1457
1347
  http_res_text = utils.stream_to_text(http_res)
1458
- raise errors.APIError(
1459
- "API error occurred", http_res.status_code, http_res_text, http_res
1460
- )
1348
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1461
1349
  if utils.match_response(http_res, "5XX", "*"):
1462
1350
  http_res_text = utils.stream_to_text(http_res)
1463
- raise errors.APIError(
1464
- "API error occurred", http_res.status_code, http_res_text, http_res
1465
- )
1351
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1466
1352
 
1467
- content_type = http_res.headers.get("Content-Type")
1468
- http_res_text = utils.stream_to_text(http_res)
1469
- raise errors.APIError(
1470
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1471
- http_res.status_code,
1472
- http_res_text,
1473
- http_res,
1474
- )
1353
+ raise errors.APIError("Unexpected response received", http_res)
1475
1354
 
1476
1355
  async def slipstream_liquidity_provision_increase_async(
1477
1356
  self,
@@ -1592,31 +1471,20 @@ class AerodromeSlipstream(BaseSDK):
1592
1471
 
1593
1472
  response_data: Any = None
1594
1473
  if utils.match_response(http_res, "200", "application/json"):
1595
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1474
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1596
1475
  if utils.match_response(http_res, "422", "application/json"):
1597
- response_data = utils.unmarshal_json(
1598
- http_res.text, errors.HTTPValidationErrorData
1476
+ response_data = utils.unmarshal_json_response(
1477
+ errors.HTTPValidationErrorData, http_res
1599
1478
  )
1600
- raise errors.HTTPValidationError(data=response_data)
1479
+ raise errors.HTTPValidationError(response_data, http_res)
1601
1480
  if utils.match_response(http_res, "4XX", "*"):
1602
1481
  http_res_text = await utils.stream_to_text_async(http_res)
1603
- raise errors.APIError(
1604
- "API error occurred", http_res.status_code, http_res_text, http_res
1605
- )
1482
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1606
1483
  if utils.match_response(http_res, "5XX", "*"):
1607
1484
  http_res_text = await utils.stream_to_text_async(http_res)
1608
- raise errors.APIError(
1609
- "API error occurred", http_res.status_code, http_res_text, http_res
1610
- )
1485
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1611
1486
 
1612
- content_type = http_res.headers.get("Content-Type")
1613
- http_res_text = await utils.stream_to_text_async(http_res)
1614
- raise errors.APIError(
1615
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1616
- http_res.status_code,
1617
- http_res_text,
1618
- http_res,
1619
- )
1487
+ raise errors.APIError("Unexpected response received", http_res)
1620
1488
 
1621
1489
  def slipstream_liquidity_provision_withdraw(
1622
1490
  self,
@@ -1719,31 +1587,20 @@ class AerodromeSlipstream(BaseSDK):
1719
1587
 
1720
1588
  response_data: Any = None
1721
1589
  if utils.match_response(http_res, "200", "application/json"):
1722
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1590
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1723
1591
  if utils.match_response(http_res, "422", "application/json"):
1724
- response_data = utils.unmarshal_json(
1725
- http_res.text, errors.HTTPValidationErrorData
1592
+ response_data = utils.unmarshal_json_response(
1593
+ errors.HTTPValidationErrorData, http_res
1726
1594
  )
1727
- raise errors.HTTPValidationError(data=response_data)
1595
+ raise errors.HTTPValidationError(response_data, http_res)
1728
1596
  if utils.match_response(http_res, "4XX", "*"):
1729
1597
  http_res_text = utils.stream_to_text(http_res)
1730
- raise errors.APIError(
1731
- "API error occurred", http_res.status_code, http_res_text, http_res
1732
- )
1598
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1733
1599
  if utils.match_response(http_res, "5XX", "*"):
1734
1600
  http_res_text = utils.stream_to_text(http_res)
1735
- raise errors.APIError(
1736
- "API error occurred", http_res.status_code, http_res_text, http_res
1737
- )
1601
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1738
1602
 
1739
- content_type = http_res.headers.get("Content-Type")
1740
- http_res_text = utils.stream_to_text(http_res)
1741
- raise errors.APIError(
1742
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1743
- http_res.status_code,
1744
- http_res_text,
1745
- http_res,
1746
- )
1603
+ raise errors.APIError("Unexpected response received", http_res)
1747
1604
 
1748
1605
  async def slipstream_liquidity_provision_withdraw_async(
1749
1606
  self,
@@ -1846,28 +1703,17 @@ class AerodromeSlipstream(BaseSDK):
1846
1703
 
1847
1704
  response_data: Any = None
1848
1705
  if utils.match_response(http_res, "200", "application/json"):
1849
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1706
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1850
1707
  if utils.match_response(http_res, "422", "application/json"):
1851
- response_data = utils.unmarshal_json(
1852
- http_res.text, errors.HTTPValidationErrorData
1708
+ response_data = utils.unmarshal_json_response(
1709
+ errors.HTTPValidationErrorData, http_res
1853
1710
  )
1854
- raise errors.HTTPValidationError(data=response_data)
1711
+ raise errors.HTTPValidationError(response_data, http_res)
1855
1712
  if utils.match_response(http_res, "4XX", "*"):
1856
1713
  http_res_text = await utils.stream_to_text_async(http_res)
1857
- raise errors.APIError(
1858
- "API error occurred", http_res.status_code, http_res_text, http_res
1859
- )
1714
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1860
1715
  if utils.match_response(http_res, "5XX", "*"):
1861
1716
  http_res_text = await utils.stream_to_text_async(http_res)
1862
- raise errors.APIError(
1863
- "API error occurred", http_res.status_code, http_res_text, http_res
1864
- )
1717
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1865
1718
 
1866
- content_type = http_res.headers.get("Content-Type")
1867
- http_res_text = await utils.stream_to_text_async(http_res)
1868
- raise errors.APIError(
1869
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1870
- http_res.status_code,
1871
- http_res_text,
1872
- http_res,
1873
- )
1719
+ raise errors.APIError("Unexpected response received", http_res)
@@ -244,7 +244,7 @@ class BaseSDK:
244
244
 
245
245
  if http_res is None:
246
246
  logger.debug("Raising no response SDK error")
247
- raise errors.APIError("No response received")
247
+ raise errors.NoResponseError("No response received")
248
248
 
249
249
  logger.debug(
250
250
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -265,7 +265,7 @@ class BaseSDK:
265
265
  http_res = result
266
266
  else:
267
267
  logger.debug("Raising unexpected SDK error")
268
- raise errors.APIError("Unexpected error occurred")
268
+ raise errors.APIError("Unexpected error occurred", http_res)
269
269
 
270
270
  return http_res
271
271
 
@@ -316,7 +316,7 @@ class BaseSDK:
316
316
 
317
317
  if http_res is None:
318
318
  logger.debug("Raising no response SDK error")
319
- raise errors.APIError("No response received")
319
+ raise errors.NoResponseError("No response received")
320
320
 
321
321
  logger.debug(
322
322
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -337,7 +337,7 @@ class BaseSDK:
337
337
  http_res = result
338
338
  else:
339
339
  logger.debug("Raising unexpected SDK error")
340
- raise errors.APIError("Unexpected error occurred")
340
+ raise errors.APIError("Unexpected error occurred", http_res)
341
341
 
342
342
  return http_res
343
343