compass_api_sdk 0.9.36__py3-none-any.whl → 0.9.38__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.

compass_api_sdk/pendle.py CHANGED
@@ -89,33 +89,22 @@ class Pendle(BaseSDK):
89
89
 
90
90
  response_data: Any = None
91
91
  if utils.match_response(http_res, "200", "application/json"):
92
- return utils.unmarshal_json(
93
- http_res.text, models.PendleGetUserPositionResponse
92
+ return utils.unmarshal_json_response(
93
+ models.PendleGetUserPositionResponse, http_res
94
94
  )
95
95
  if utils.match_response(http_res, "422", "application/json"):
96
- response_data = utils.unmarshal_json(
97
- http_res.text, errors.HTTPValidationErrorData
96
+ response_data = utils.unmarshal_json_response(
97
+ errors.HTTPValidationErrorData, http_res
98
98
  )
99
- raise errors.HTTPValidationError(data=response_data)
99
+ raise errors.HTTPValidationError(response_data, http_res)
100
100
  if utils.match_response(http_res, "4XX", "*"):
101
101
  http_res_text = utils.stream_to_text(http_res)
102
- raise errors.APIError(
103
- "API error occurred", http_res.status_code, http_res_text, http_res
104
- )
102
+ raise errors.APIError("API error occurred", http_res, http_res_text)
105
103
  if utils.match_response(http_res, "5XX", "*"):
106
104
  http_res_text = utils.stream_to_text(http_res)
107
- raise errors.APIError(
108
- "API error occurred", http_res.status_code, http_res_text, http_res
109
- )
105
+ raise errors.APIError("API error occurred", http_res, http_res_text)
110
106
 
111
- content_type = http_res.headers.get("Content-Type")
112
- http_res_text = utils.stream_to_text(http_res)
113
- raise errors.APIError(
114
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
115
- http_res.status_code,
116
- http_res_text,
117
- http_res,
118
- )
107
+ raise errors.APIError("Unexpected response received", http_res)
119
108
 
120
109
  async def position_async(
121
110
  self,
@@ -198,33 +187,22 @@ class Pendle(BaseSDK):
198
187
 
199
188
  response_data: Any = None
200
189
  if utils.match_response(http_res, "200", "application/json"):
201
- return utils.unmarshal_json(
202
- http_res.text, models.PendleGetUserPositionResponse
190
+ return utils.unmarshal_json_response(
191
+ models.PendleGetUserPositionResponse, http_res
203
192
  )
204
193
  if utils.match_response(http_res, "422", "application/json"):
205
- response_data = utils.unmarshal_json(
206
- http_res.text, errors.HTTPValidationErrorData
194
+ response_data = utils.unmarshal_json_response(
195
+ errors.HTTPValidationErrorData, http_res
207
196
  )
208
- raise errors.HTTPValidationError(data=response_data)
197
+ raise errors.HTTPValidationError(response_data, http_res)
209
198
  if utils.match_response(http_res, "4XX", "*"):
210
199
  http_res_text = await utils.stream_to_text_async(http_res)
211
- raise errors.APIError(
212
- "API error occurred", http_res.status_code, http_res_text, http_res
213
- )
200
+ raise errors.APIError("API error occurred", http_res, http_res_text)
214
201
  if utils.match_response(http_res, "5XX", "*"):
215
202
  http_res_text = await utils.stream_to_text_async(http_res)
216
- raise errors.APIError(
217
- "API error occurred", http_res.status_code, http_res_text, http_res
218
- )
203
+ raise errors.APIError("API error occurred", http_res, http_res_text)
219
204
 
220
- content_type = http_res.headers.get("Content-Type")
221
- http_res_text = await utils.stream_to_text_async(http_res)
222
- raise errors.APIError(
223
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
224
- http_res.status_code,
225
- http_res_text,
226
- http_res,
227
- )
205
+ raise errors.APIError("Unexpected response received", http_res)
228
206
 
229
207
  def positions(
230
208
  self,
@@ -301,33 +279,22 @@ class Pendle(BaseSDK):
301
279
 
302
280
  response_data: Any = None
303
281
  if utils.match_response(http_res, "200", "application/json"):
304
- return utils.unmarshal_json(
305
- http_res.text, models.PendleListUserPositionsResponse
282
+ return utils.unmarshal_json_response(
283
+ models.PendleListUserPositionsResponse, http_res
306
284
  )
307
285
  if utils.match_response(http_res, "422", "application/json"):
308
- response_data = utils.unmarshal_json(
309
- http_res.text, errors.HTTPValidationErrorData
286
+ response_data = utils.unmarshal_json_response(
287
+ errors.HTTPValidationErrorData, http_res
310
288
  )
311
- raise errors.HTTPValidationError(data=response_data)
289
+ raise errors.HTTPValidationError(response_data, http_res)
312
290
  if utils.match_response(http_res, "4XX", "*"):
313
291
  http_res_text = utils.stream_to_text(http_res)
314
- raise errors.APIError(
315
- "API error occurred", http_res.status_code, http_res_text, http_res
316
- )
292
+ raise errors.APIError("API error occurred", http_res, http_res_text)
317
293
  if utils.match_response(http_res, "5XX", "*"):
318
294
  http_res_text = utils.stream_to_text(http_res)
319
- raise errors.APIError(
320
- "API error occurred", http_res.status_code, http_res_text, http_res
321
- )
295
+ raise errors.APIError("API error occurred", http_res, http_res_text)
322
296
 
323
- content_type = http_res.headers.get("Content-Type")
324
- http_res_text = utils.stream_to_text(http_res)
325
- raise errors.APIError(
326
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
327
- http_res.status_code,
328
- http_res_text,
329
- http_res,
330
- )
297
+ raise errors.APIError("Unexpected response received", http_res)
331
298
 
332
299
  async def positions_async(
333
300
  self,
@@ -404,33 +371,22 @@ class Pendle(BaseSDK):
404
371
 
405
372
  response_data: Any = None
406
373
  if utils.match_response(http_res, "200", "application/json"):
407
- return utils.unmarshal_json(
408
- http_res.text, models.PendleListUserPositionsResponse
374
+ return utils.unmarshal_json_response(
375
+ models.PendleListUserPositionsResponse, http_res
409
376
  )
410
377
  if utils.match_response(http_res, "422", "application/json"):
411
- response_data = utils.unmarshal_json(
412
- http_res.text, errors.HTTPValidationErrorData
378
+ response_data = utils.unmarshal_json_response(
379
+ errors.HTTPValidationErrorData, http_res
413
380
  )
414
- raise errors.HTTPValidationError(data=response_data)
381
+ raise errors.HTTPValidationError(response_data, http_res)
415
382
  if utils.match_response(http_res, "4XX", "*"):
416
383
  http_res_text = await utils.stream_to_text_async(http_res)
417
- raise errors.APIError(
418
- "API error occurred", http_res.status_code, http_res_text, http_res
419
- )
384
+ raise errors.APIError("API error occurred", http_res, http_res_text)
420
385
  if utils.match_response(http_res, "5XX", "*"):
421
386
  http_res_text = await utils.stream_to_text_async(http_res)
422
- raise errors.APIError(
423
- "API error occurred", http_res.status_code, http_res_text, http_res
424
- )
387
+ raise errors.APIError("API error occurred", http_res, http_res_text)
425
388
 
426
- content_type = http_res.headers.get("Content-Type")
427
- http_res_text = await utils.stream_to_text_async(http_res)
428
- raise errors.APIError(
429
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
430
- http_res.status_code,
431
- http_res_text,
432
- http_res,
433
- )
389
+ raise errors.APIError("Unexpected response received", http_res)
434
390
 
435
391
  def market(
436
392
  self,
@@ -510,31 +466,22 @@ class Pendle(BaseSDK):
510
466
 
511
467
  response_data: Any = None
512
468
  if utils.match_response(http_res, "200", "application/json"):
513
- return utils.unmarshal_json(http_res.text, models.PendleGetMarketResponse)
469
+ return utils.unmarshal_json_response(
470
+ models.PendleGetMarketResponse, http_res
471
+ )
514
472
  if utils.match_response(http_res, "422", "application/json"):
515
- response_data = utils.unmarshal_json(
516
- http_res.text, errors.HTTPValidationErrorData
473
+ response_data = utils.unmarshal_json_response(
474
+ errors.HTTPValidationErrorData, http_res
517
475
  )
518
- raise errors.HTTPValidationError(data=response_data)
476
+ raise errors.HTTPValidationError(response_data, http_res)
519
477
  if utils.match_response(http_res, "4XX", "*"):
520
478
  http_res_text = utils.stream_to_text(http_res)
521
- raise errors.APIError(
522
- "API error occurred", http_res.status_code, http_res_text, http_res
523
- )
479
+ raise errors.APIError("API error occurred", http_res, http_res_text)
524
480
  if utils.match_response(http_res, "5XX", "*"):
525
481
  http_res_text = utils.stream_to_text(http_res)
526
- raise errors.APIError(
527
- "API error occurred", http_res.status_code, http_res_text, http_res
528
- )
482
+ raise errors.APIError("API error occurred", http_res, http_res_text)
529
483
 
530
- content_type = http_res.headers.get("Content-Type")
531
- http_res_text = utils.stream_to_text(http_res)
532
- raise errors.APIError(
533
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
534
- http_res.status_code,
535
- http_res_text,
536
- http_res,
537
- )
484
+ raise errors.APIError("Unexpected response received", http_res)
538
485
 
539
486
  async def market_async(
540
487
  self,
@@ -614,31 +561,22 @@ class Pendle(BaseSDK):
614
561
 
615
562
  response_data: Any = None
616
563
  if utils.match_response(http_res, "200", "application/json"):
617
- return utils.unmarshal_json(http_res.text, models.PendleGetMarketResponse)
564
+ return utils.unmarshal_json_response(
565
+ models.PendleGetMarketResponse, http_res
566
+ )
618
567
  if utils.match_response(http_res, "422", "application/json"):
619
- response_data = utils.unmarshal_json(
620
- http_res.text, errors.HTTPValidationErrorData
568
+ response_data = utils.unmarshal_json_response(
569
+ errors.HTTPValidationErrorData, http_res
621
570
  )
622
- raise errors.HTTPValidationError(data=response_data)
571
+ raise errors.HTTPValidationError(response_data, http_res)
623
572
  if utils.match_response(http_res, "4XX", "*"):
624
573
  http_res_text = await utils.stream_to_text_async(http_res)
625
- raise errors.APIError(
626
- "API error occurred", http_res.status_code, http_res_text, http_res
627
- )
574
+ raise errors.APIError("API error occurred", http_res, http_res_text)
628
575
  if utils.match_response(http_res, "5XX", "*"):
629
576
  http_res_text = await utils.stream_to_text_async(http_res)
630
- raise errors.APIError(
631
- "API error occurred", http_res.status_code, http_res_text, http_res
632
- )
577
+ raise errors.APIError("API error occurred", http_res, http_res_text)
633
578
 
634
- content_type = http_res.headers.get("Content-Type")
635
- http_res_text = await utils.stream_to_text_async(http_res)
636
- raise errors.APIError(
637
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
638
- http_res.status_code,
639
- http_res_text,
640
- http_res,
641
- )
579
+ raise errors.APIError("Unexpected response received", http_res)
642
580
 
643
581
  def markets(
644
582
  self,
@@ -712,31 +650,22 @@ class Pendle(BaseSDK):
712
650
 
713
651
  response_data: Any = None
714
652
  if utils.match_response(http_res, "200", "application/json"):
715
- return utils.unmarshal_json(http_res.text, models.PendleListMarketsResponse)
653
+ return utils.unmarshal_json_response(
654
+ models.PendleListMarketsResponse, http_res
655
+ )
716
656
  if utils.match_response(http_res, "422", "application/json"):
717
- response_data = utils.unmarshal_json(
718
- http_res.text, errors.HTTPValidationErrorData
657
+ response_data = utils.unmarshal_json_response(
658
+ errors.HTTPValidationErrorData, http_res
719
659
  )
720
- raise errors.HTTPValidationError(data=response_data)
660
+ raise errors.HTTPValidationError(response_data, http_res)
721
661
  if utils.match_response(http_res, "4XX", "*"):
722
662
  http_res_text = utils.stream_to_text(http_res)
723
- raise errors.APIError(
724
- "API error occurred", http_res.status_code, http_res_text, http_res
725
- )
663
+ raise errors.APIError("API error occurred", http_res, http_res_text)
726
664
  if utils.match_response(http_res, "5XX", "*"):
727
665
  http_res_text = utils.stream_to_text(http_res)
728
- raise errors.APIError(
729
- "API error occurred", http_res.status_code, http_res_text, http_res
730
- )
666
+ raise errors.APIError("API error occurred", http_res, http_res_text)
731
667
 
732
- content_type = http_res.headers.get("Content-Type")
733
- http_res_text = utils.stream_to_text(http_res)
734
- raise errors.APIError(
735
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
736
- http_res.status_code,
737
- http_res_text,
738
- http_res,
739
- )
668
+ raise errors.APIError("Unexpected response received", http_res)
740
669
 
741
670
  async def markets_async(
742
671
  self,
@@ -810,31 +739,22 @@ class Pendle(BaseSDK):
810
739
 
811
740
  response_data: Any = None
812
741
  if utils.match_response(http_res, "200", "application/json"):
813
- return utils.unmarshal_json(http_res.text, models.PendleListMarketsResponse)
742
+ return utils.unmarshal_json_response(
743
+ models.PendleListMarketsResponse, http_res
744
+ )
814
745
  if utils.match_response(http_res, "422", "application/json"):
815
- response_data = utils.unmarshal_json(
816
- http_res.text, errors.HTTPValidationErrorData
746
+ response_data = utils.unmarshal_json_response(
747
+ errors.HTTPValidationErrorData, http_res
817
748
  )
818
- raise errors.HTTPValidationError(data=response_data)
749
+ raise errors.HTTPValidationError(response_data, http_res)
819
750
  if utils.match_response(http_res, "4XX", "*"):
820
751
  http_res_text = await utils.stream_to_text_async(http_res)
821
- raise errors.APIError(
822
- "API error occurred", http_res.status_code, http_res_text, http_res
823
- )
752
+ raise errors.APIError("API error occurred", http_res, http_res_text)
824
753
  if utils.match_response(http_res, "5XX", "*"):
825
754
  http_res_text = await utils.stream_to_text_async(http_res)
826
- raise errors.APIError(
827
- "API error occurred", http_res.status_code, http_res_text, http_res
828
- )
755
+ raise errors.APIError("API error occurred", http_res, http_res_text)
829
756
 
830
- content_type = http_res.headers.get("Content-Type")
831
- http_res_text = await utils.stream_to_text_async(http_res)
832
- raise errors.APIError(
833
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
834
- http_res.status_code,
835
- http_res_text,
836
- http_res,
837
- )
757
+ raise errors.APIError("Unexpected response received", http_res)
838
758
 
839
759
  def buy_pt(
840
760
  self,
@@ -925,31 +845,20 @@ class Pendle(BaseSDK):
925
845
 
926
846
  response_data: Any = None
927
847
  if utils.match_response(http_res, "200", "application/json"):
928
- return utils.unmarshal_json(http_res.text, models.TxResponse)
848
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
929
849
  if utils.match_response(http_res, "422", "application/json"):
930
- response_data = utils.unmarshal_json(
931
- http_res.text, errors.HTTPValidationErrorData
850
+ response_data = utils.unmarshal_json_response(
851
+ errors.HTTPValidationErrorData, http_res
932
852
  )
933
- raise errors.HTTPValidationError(data=response_data)
853
+ raise errors.HTTPValidationError(response_data, http_res)
934
854
  if utils.match_response(http_res, "4XX", "*"):
935
855
  http_res_text = utils.stream_to_text(http_res)
936
- raise errors.APIError(
937
- "API error occurred", http_res.status_code, http_res_text, http_res
938
- )
856
+ raise errors.APIError("API error occurred", http_res, http_res_text)
939
857
  if utils.match_response(http_res, "5XX", "*"):
940
858
  http_res_text = utils.stream_to_text(http_res)
941
- raise errors.APIError(
942
- "API error occurred", http_res.status_code, http_res_text, http_res
943
- )
859
+ raise errors.APIError("API error occurred", http_res, http_res_text)
944
860
 
945
- content_type = http_res.headers.get("Content-Type")
946
- http_res_text = utils.stream_to_text(http_res)
947
- raise errors.APIError(
948
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
949
- http_res.status_code,
950
- http_res_text,
951
- http_res,
952
- )
861
+ raise errors.APIError("Unexpected response received", http_res)
953
862
 
954
863
  async def buy_pt_async(
955
864
  self,
@@ -1040,31 +949,20 @@ class Pendle(BaseSDK):
1040
949
 
1041
950
  response_data: Any = None
1042
951
  if utils.match_response(http_res, "200", "application/json"):
1043
- return utils.unmarshal_json(http_res.text, models.TxResponse)
952
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1044
953
  if utils.match_response(http_res, "422", "application/json"):
1045
- response_data = utils.unmarshal_json(
1046
- http_res.text, errors.HTTPValidationErrorData
954
+ response_data = utils.unmarshal_json_response(
955
+ errors.HTTPValidationErrorData, http_res
1047
956
  )
1048
- raise errors.HTTPValidationError(data=response_data)
957
+ raise errors.HTTPValidationError(response_data, http_res)
1049
958
  if utils.match_response(http_res, "4XX", "*"):
1050
959
  http_res_text = await utils.stream_to_text_async(http_res)
1051
- raise errors.APIError(
1052
- "API error occurred", http_res.status_code, http_res_text, http_res
1053
- )
960
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1054
961
  if utils.match_response(http_res, "5XX", "*"):
1055
962
  http_res_text = await utils.stream_to_text_async(http_res)
1056
- raise errors.APIError(
1057
- "API error occurred", http_res.status_code, http_res_text, http_res
1058
- )
963
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1059
964
 
1060
- content_type = http_res.headers.get("Content-Type")
1061
- http_res_text = await utils.stream_to_text_async(http_res)
1062
- raise errors.APIError(
1063
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1064
- http_res.status_code,
1065
- http_res_text,
1066
- http_res,
1067
- )
965
+ raise errors.APIError("Unexpected response received", http_res)
1068
966
 
1069
967
  def sell_pt(
1070
968
  self,
@@ -1155,31 +1053,20 @@ class Pendle(BaseSDK):
1155
1053
 
1156
1054
  response_data: Any = None
1157
1055
  if utils.match_response(http_res, "200", "application/json"):
1158
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1056
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1159
1057
  if utils.match_response(http_res, "422", "application/json"):
1160
- response_data = utils.unmarshal_json(
1161
- http_res.text, errors.HTTPValidationErrorData
1058
+ response_data = utils.unmarshal_json_response(
1059
+ errors.HTTPValidationErrorData, http_res
1162
1060
  )
1163
- raise errors.HTTPValidationError(data=response_data)
1061
+ raise errors.HTTPValidationError(response_data, http_res)
1164
1062
  if utils.match_response(http_res, "4XX", "*"):
1165
1063
  http_res_text = utils.stream_to_text(http_res)
1166
- raise errors.APIError(
1167
- "API error occurred", http_res.status_code, http_res_text, http_res
1168
- )
1064
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1169
1065
  if utils.match_response(http_res, "5XX", "*"):
1170
1066
  http_res_text = utils.stream_to_text(http_res)
1171
- raise errors.APIError(
1172
- "API error occurred", http_res.status_code, http_res_text, http_res
1173
- )
1067
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1174
1068
 
1175
- content_type = http_res.headers.get("Content-Type")
1176
- http_res_text = utils.stream_to_text(http_res)
1177
- raise errors.APIError(
1178
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1179
- http_res.status_code,
1180
- http_res_text,
1181
- http_res,
1182
- )
1069
+ raise errors.APIError("Unexpected response received", http_res)
1183
1070
 
1184
1071
  async def sell_pt_async(
1185
1072
  self,
@@ -1270,31 +1157,20 @@ class Pendle(BaseSDK):
1270
1157
 
1271
1158
  response_data: Any = None
1272
1159
  if utils.match_response(http_res, "200", "application/json"):
1273
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1160
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1274
1161
  if utils.match_response(http_res, "422", "application/json"):
1275
- response_data = utils.unmarshal_json(
1276
- http_res.text, errors.HTTPValidationErrorData
1162
+ response_data = utils.unmarshal_json_response(
1163
+ errors.HTTPValidationErrorData, http_res
1277
1164
  )
1278
- raise errors.HTTPValidationError(data=response_data)
1165
+ raise errors.HTTPValidationError(response_data, http_res)
1279
1166
  if utils.match_response(http_res, "4XX", "*"):
1280
1167
  http_res_text = await utils.stream_to_text_async(http_res)
1281
- raise errors.APIError(
1282
- "API error occurred", http_res.status_code, http_res_text, http_res
1283
- )
1168
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1284
1169
  if utils.match_response(http_res, "5XX", "*"):
1285
1170
  http_res_text = await utils.stream_to_text_async(http_res)
1286
- raise errors.APIError(
1287
- "API error occurred", http_res.status_code, http_res_text, http_res
1288
- )
1171
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1289
1172
 
1290
- content_type = http_res.headers.get("Content-Type")
1291
- http_res_text = await utils.stream_to_text_async(http_res)
1292
- raise errors.APIError(
1293
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1294
- http_res.status_code,
1295
- http_res_text,
1296
- http_res,
1297
- )
1173
+ raise errors.APIError("Unexpected response received", http_res)
1298
1174
 
1299
1175
  def buy_yt(
1300
1176
  self,
@@ -1385,31 +1261,20 @@ class Pendle(BaseSDK):
1385
1261
 
1386
1262
  response_data: Any = None
1387
1263
  if utils.match_response(http_res, "200", "application/json"):
1388
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1264
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1389
1265
  if utils.match_response(http_res, "422", "application/json"):
1390
- response_data = utils.unmarshal_json(
1391
- http_res.text, errors.HTTPValidationErrorData
1266
+ response_data = utils.unmarshal_json_response(
1267
+ errors.HTTPValidationErrorData, http_res
1392
1268
  )
1393
- raise errors.HTTPValidationError(data=response_data)
1269
+ raise errors.HTTPValidationError(response_data, http_res)
1394
1270
  if utils.match_response(http_res, "4XX", "*"):
1395
1271
  http_res_text = utils.stream_to_text(http_res)
1396
- raise errors.APIError(
1397
- "API error occurred", http_res.status_code, http_res_text, http_res
1398
- )
1272
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1399
1273
  if utils.match_response(http_res, "5XX", "*"):
1400
1274
  http_res_text = utils.stream_to_text(http_res)
1401
- raise errors.APIError(
1402
- "API error occurred", http_res.status_code, http_res_text, http_res
1403
- )
1275
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1404
1276
 
1405
- content_type = http_res.headers.get("Content-Type")
1406
- http_res_text = utils.stream_to_text(http_res)
1407
- raise errors.APIError(
1408
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1409
- http_res.status_code,
1410
- http_res_text,
1411
- http_res,
1412
- )
1277
+ raise errors.APIError("Unexpected response received", http_res)
1413
1278
 
1414
1279
  async def buy_yt_async(
1415
1280
  self,
@@ -1500,31 +1365,20 @@ class Pendle(BaseSDK):
1500
1365
 
1501
1366
  response_data: Any = None
1502
1367
  if utils.match_response(http_res, "200", "application/json"):
1503
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1368
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1504
1369
  if utils.match_response(http_res, "422", "application/json"):
1505
- response_data = utils.unmarshal_json(
1506
- http_res.text, errors.HTTPValidationErrorData
1370
+ response_data = utils.unmarshal_json_response(
1371
+ errors.HTTPValidationErrorData, http_res
1507
1372
  )
1508
- raise errors.HTTPValidationError(data=response_data)
1373
+ raise errors.HTTPValidationError(response_data, http_res)
1509
1374
  if utils.match_response(http_res, "4XX", "*"):
1510
1375
  http_res_text = await utils.stream_to_text_async(http_res)
1511
- raise errors.APIError(
1512
- "API error occurred", http_res.status_code, http_res_text, http_res
1513
- )
1376
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1514
1377
  if utils.match_response(http_res, "5XX", "*"):
1515
1378
  http_res_text = await utils.stream_to_text_async(http_res)
1516
- raise errors.APIError(
1517
- "API error occurred", http_res.status_code, http_res_text, http_res
1518
- )
1379
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1519
1380
 
1520
- content_type = http_res.headers.get("Content-Type")
1521
- http_res_text = await utils.stream_to_text_async(http_res)
1522
- raise errors.APIError(
1523
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1524
- http_res.status_code,
1525
- http_res_text,
1526
- http_res,
1527
- )
1381
+ raise errors.APIError("Unexpected response received", http_res)
1528
1382
 
1529
1383
  def sell_yt(
1530
1384
  self,
@@ -1615,31 +1469,20 @@ class Pendle(BaseSDK):
1615
1469
 
1616
1470
  response_data: Any = None
1617
1471
  if utils.match_response(http_res, "200", "application/json"):
1618
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1472
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1619
1473
  if utils.match_response(http_res, "422", "application/json"):
1620
- response_data = utils.unmarshal_json(
1621
- http_res.text, errors.HTTPValidationErrorData
1474
+ response_data = utils.unmarshal_json_response(
1475
+ errors.HTTPValidationErrorData, http_res
1622
1476
  )
1623
- raise errors.HTTPValidationError(data=response_data)
1477
+ raise errors.HTTPValidationError(response_data, http_res)
1624
1478
  if utils.match_response(http_res, "4XX", "*"):
1625
1479
  http_res_text = utils.stream_to_text(http_res)
1626
- raise errors.APIError(
1627
- "API error occurred", http_res.status_code, http_res_text, http_res
1628
- )
1480
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1629
1481
  if utils.match_response(http_res, "5XX", "*"):
1630
1482
  http_res_text = utils.stream_to_text(http_res)
1631
- raise errors.APIError(
1632
- "API error occurred", http_res.status_code, http_res_text, http_res
1633
- )
1483
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1634
1484
 
1635
- content_type = http_res.headers.get("Content-Type")
1636
- http_res_text = utils.stream_to_text(http_res)
1637
- raise errors.APIError(
1638
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1639
- http_res.status_code,
1640
- http_res_text,
1641
- http_res,
1642
- )
1485
+ raise errors.APIError("Unexpected response received", http_res)
1643
1486
 
1644
1487
  async def sell_yt_async(
1645
1488
  self,
@@ -1730,31 +1573,20 @@ class Pendle(BaseSDK):
1730
1573
 
1731
1574
  response_data: Any = None
1732
1575
  if utils.match_response(http_res, "200", "application/json"):
1733
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1576
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1734
1577
  if utils.match_response(http_res, "422", "application/json"):
1735
- response_data = utils.unmarshal_json(
1736
- http_res.text, errors.HTTPValidationErrorData
1578
+ response_data = utils.unmarshal_json_response(
1579
+ errors.HTTPValidationErrorData, http_res
1737
1580
  )
1738
- raise errors.HTTPValidationError(data=response_data)
1581
+ raise errors.HTTPValidationError(response_data, http_res)
1739
1582
  if utils.match_response(http_res, "4XX", "*"):
1740
1583
  http_res_text = await utils.stream_to_text_async(http_res)
1741
- raise errors.APIError(
1742
- "API error occurred", http_res.status_code, http_res_text, http_res
1743
- )
1584
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1744
1585
  if utils.match_response(http_res, "5XX", "*"):
1745
1586
  http_res_text = await utils.stream_to_text_async(http_res)
1746
- raise errors.APIError(
1747
- "API error occurred", http_res.status_code, http_res_text, http_res
1748
- )
1587
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1749
1588
 
1750
- content_type = http_res.headers.get("Content-Type")
1751
- http_res_text = await utils.stream_to_text_async(http_res)
1752
- raise errors.APIError(
1753
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1754
- http_res.status_code,
1755
- http_res_text,
1756
- http_res,
1757
- )
1589
+ raise errors.APIError("Unexpected response received", http_res)
1758
1590
 
1759
1591
  def redeem_yield(
1760
1592
  self,
@@ -1837,31 +1669,20 @@ class Pendle(BaseSDK):
1837
1669
 
1838
1670
  response_data: Any = None
1839
1671
  if utils.match_response(http_res, "200", "application/json"):
1840
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1672
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1841
1673
  if utils.match_response(http_res, "422", "application/json"):
1842
- response_data = utils.unmarshal_json(
1843
- http_res.text, errors.HTTPValidationErrorData
1674
+ response_data = utils.unmarshal_json_response(
1675
+ errors.HTTPValidationErrorData, http_res
1844
1676
  )
1845
- raise errors.HTTPValidationError(data=response_data)
1677
+ raise errors.HTTPValidationError(response_data, http_res)
1846
1678
  if utils.match_response(http_res, "4XX", "*"):
1847
1679
  http_res_text = utils.stream_to_text(http_res)
1848
- raise errors.APIError(
1849
- "API error occurred", http_res.status_code, http_res_text, http_res
1850
- )
1680
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1851
1681
  if utils.match_response(http_res, "5XX", "*"):
1852
1682
  http_res_text = utils.stream_to_text(http_res)
1853
- raise errors.APIError(
1854
- "API error occurred", http_res.status_code, http_res_text, http_res
1855
- )
1683
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1856
1684
 
1857
- content_type = http_res.headers.get("Content-Type")
1858
- http_res_text = utils.stream_to_text(http_res)
1859
- raise errors.APIError(
1860
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1861
- http_res.status_code,
1862
- http_res_text,
1863
- http_res,
1864
- )
1685
+ raise errors.APIError("Unexpected response received", http_res)
1865
1686
 
1866
1687
  async def redeem_yield_async(
1867
1688
  self,
@@ -1944,31 +1765,20 @@ class Pendle(BaseSDK):
1944
1765
 
1945
1766
  response_data: Any = None
1946
1767
  if utils.match_response(http_res, "200", "application/json"):
1947
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1768
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1948
1769
  if utils.match_response(http_res, "422", "application/json"):
1949
- response_data = utils.unmarshal_json(
1950
- http_res.text, errors.HTTPValidationErrorData
1770
+ response_data = utils.unmarshal_json_response(
1771
+ errors.HTTPValidationErrorData, http_res
1951
1772
  )
1952
- raise errors.HTTPValidationError(data=response_data)
1773
+ raise errors.HTTPValidationError(response_data, http_res)
1953
1774
  if utils.match_response(http_res, "4XX", "*"):
1954
1775
  http_res_text = await utils.stream_to_text_async(http_res)
1955
- raise errors.APIError(
1956
- "API error occurred", http_res.status_code, http_res_text, http_res
1957
- )
1776
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1958
1777
  if utils.match_response(http_res, "5XX", "*"):
1959
1778
  http_res_text = await utils.stream_to_text_async(http_res)
1960
- raise errors.APIError(
1961
- "API error occurred", http_res.status_code, http_res_text, http_res
1962
- )
1779
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1963
1780
 
1964
- content_type = http_res.headers.get("Content-Type")
1965
- http_res_text = await utils.stream_to_text_async(http_res)
1966
- raise errors.APIError(
1967
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1968
- http_res.status_code,
1969
- http_res_text,
1970
- http_res,
1971
- )
1781
+ raise errors.APIError("Unexpected response received", http_res)
1972
1782
 
1973
1783
  def add_liquidity(
1974
1784
  self,
@@ -2063,31 +1873,20 @@ class Pendle(BaseSDK):
2063
1873
 
2064
1874
  response_data: Any = None
2065
1875
  if utils.match_response(http_res, "200", "application/json"):
2066
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1876
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2067
1877
  if utils.match_response(http_res, "422", "application/json"):
2068
- response_data = utils.unmarshal_json(
2069
- http_res.text, errors.HTTPValidationErrorData
1878
+ response_data = utils.unmarshal_json_response(
1879
+ errors.HTTPValidationErrorData, http_res
2070
1880
  )
2071
- raise errors.HTTPValidationError(data=response_data)
1881
+ raise errors.HTTPValidationError(response_data, http_res)
2072
1882
  if utils.match_response(http_res, "4XX", "*"):
2073
1883
  http_res_text = utils.stream_to_text(http_res)
2074
- raise errors.APIError(
2075
- "API error occurred", http_res.status_code, http_res_text, http_res
2076
- )
1884
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2077
1885
  if utils.match_response(http_res, "5XX", "*"):
2078
1886
  http_res_text = utils.stream_to_text(http_res)
2079
- raise errors.APIError(
2080
- "API error occurred", http_res.status_code, http_res_text, http_res
2081
- )
1887
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2082
1888
 
2083
- content_type = http_res.headers.get("Content-Type")
2084
- http_res_text = utils.stream_to_text(http_res)
2085
- raise errors.APIError(
2086
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2087
- http_res.status_code,
2088
- http_res_text,
2089
- http_res,
2090
- )
1889
+ raise errors.APIError("Unexpected response received", http_res)
2091
1890
 
2092
1891
  async def add_liquidity_async(
2093
1892
  self,
@@ -2182,31 +1981,20 @@ class Pendle(BaseSDK):
2182
1981
 
2183
1982
  response_data: Any = None
2184
1983
  if utils.match_response(http_res, "200", "application/json"):
2185
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1984
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2186
1985
  if utils.match_response(http_res, "422", "application/json"):
2187
- response_data = utils.unmarshal_json(
2188
- http_res.text, errors.HTTPValidationErrorData
1986
+ response_data = utils.unmarshal_json_response(
1987
+ errors.HTTPValidationErrorData, http_res
2189
1988
  )
2190
- raise errors.HTTPValidationError(data=response_data)
1989
+ raise errors.HTTPValidationError(response_data, http_res)
2191
1990
  if utils.match_response(http_res, "4XX", "*"):
2192
1991
  http_res_text = await utils.stream_to_text_async(http_res)
2193
- raise errors.APIError(
2194
- "API error occurred", http_res.status_code, http_res_text, http_res
2195
- )
1992
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2196
1993
  if utils.match_response(http_res, "5XX", "*"):
2197
1994
  http_res_text = await utils.stream_to_text_async(http_res)
2198
- raise errors.APIError(
2199
- "API error occurred", http_res.status_code, http_res_text, http_res
2200
- )
1995
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2201
1996
 
2202
- content_type = http_res.headers.get("Content-Type")
2203
- http_res_text = await utils.stream_to_text_async(http_res)
2204
- raise errors.APIError(
2205
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2206
- http_res.status_code,
2207
- http_res_text,
2208
- http_res,
2209
- )
1997
+ raise errors.APIError("Unexpected response received", http_res)
2210
1998
 
2211
1999
  def remove_liquidity(
2212
2000
  self,
@@ -2302,31 +2090,20 @@ class Pendle(BaseSDK):
2302
2090
 
2303
2091
  response_data: Any = None
2304
2092
  if utils.match_response(http_res, "200", "application/json"):
2305
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2093
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2306
2094
  if utils.match_response(http_res, "422", "application/json"):
2307
- response_data = utils.unmarshal_json(
2308
- http_res.text, errors.HTTPValidationErrorData
2095
+ response_data = utils.unmarshal_json_response(
2096
+ errors.HTTPValidationErrorData, http_res
2309
2097
  )
2310
- raise errors.HTTPValidationError(data=response_data)
2098
+ raise errors.HTTPValidationError(response_data, http_res)
2311
2099
  if utils.match_response(http_res, "4XX", "*"):
2312
2100
  http_res_text = utils.stream_to_text(http_res)
2313
- raise errors.APIError(
2314
- "API error occurred", http_res.status_code, http_res_text, http_res
2315
- )
2101
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2316
2102
  if utils.match_response(http_res, "5XX", "*"):
2317
2103
  http_res_text = utils.stream_to_text(http_res)
2318
- raise errors.APIError(
2319
- "API error occurred", http_res.status_code, http_res_text, http_res
2320
- )
2104
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2321
2105
 
2322
- content_type = http_res.headers.get("Content-Type")
2323
- http_res_text = utils.stream_to_text(http_res)
2324
- raise errors.APIError(
2325
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2326
- http_res.status_code,
2327
- http_res_text,
2328
- http_res,
2329
- )
2106
+ raise errors.APIError("Unexpected response received", http_res)
2330
2107
 
2331
2108
  async def remove_liquidity_async(
2332
2109
  self,
@@ -2422,28 +2199,17 @@ class Pendle(BaseSDK):
2422
2199
 
2423
2200
  response_data: Any = None
2424
2201
  if utils.match_response(http_res, "200", "application/json"):
2425
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2202
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2426
2203
  if utils.match_response(http_res, "422", "application/json"):
2427
- response_data = utils.unmarshal_json(
2428
- http_res.text, errors.HTTPValidationErrorData
2204
+ response_data = utils.unmarshal_json_response(
2205
+ errors.HTTPValidationErrorData, http_res
2429
2206
  )
2430
- raise errors.HTTPValidationError(data=response_data)
2207
+ raise errors.HTTPValidationError(response_data, http_res)
2431
2208
  if utils.match_response(http_res, "4XX", "*"):
2432
2209
  http_res_text = await utils.stream_to_text_async(http_res)
2433
- raise errors.APIError(
2434
- "API error occurred", http_res.status_code, http_res_text, http_res
2435
- )
2210
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2436
2211
  if utils.match_response(http_res, "5XX", "*"):
2437
2212
  http_res_text = await utils.stream_to_text_async(http_res)
2438
- raise errors.APIError(
2439
- "API error occurred", http_res.status_code, http_res_text, http_res
2440
- )
2213
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2441
2214
 
2442
- content_type = http_res.headers.get("Content-Type")
2443
- http_res_text = await utils.stream_to_text_async(http_res)
2444
- raise errors.APIError(
2445
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2446
- http_res.status_code,
2447
- http_res_text,
2448
- http_res,
2449
- )
2215
+ raise errors.APIError("Unexpected response received", http_res)