lambdadb 0.3.5__py3-none-any.whl → 0.3.6__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 lambdadb might be problematic. Click here for more details.
- lambdadb/_version.py +3 -3
- lambdadb/basesdk.py +4 -4
- lambdadb/collections.py +234 -350
- lambdadb/docs.py +239 -367
- lambdadb/errors/__init__.py +9 -0
- lambdadb/errors/apierror.py +30 -14
- lambdadb/errors/badrequest_error.py +12 -6
- lambdadb/errors/internalservererror.py +12 -6
- lambdadb/errors/lambdadberror.py +26 -0
- lambdadb/errors/no_response_error.py +13 -0
- lambdadb/errors/resourcealreadyexists_error.py +12 -6
- lambdadb/errors/resourcenotfound_error.py +12 -6
- lambdadb/errors/responsevalidationerror.py +25 -0
- lambdadb/errors/toomanyrequests_error.py +12 -6
- lambdadb/errors/unauthenticated_error.py +12 -6
- lambdadb/models/__init__.py +0 -42
- lambdadb/models/deletedocsop.py +3 -11
- lambdadb/models/fetchdocsop.py +3 -11
- lambdadb/models/querycollectionop.py +7 -31
- lambdadb/models/updatedocsop.py +3 -11
- lambdadb/models/upsertdocsop.py +3 -11
- lambdadb/utils/__init__.py +3 -0
- lambdadb/utils/serializers.py +21 -3
- {lambdadb-0.3.5.dist-info → lambdadb-0.3.6.dist-info}/METADATA +49 -36
- {lambdadb-0.3.5.dist-info → lambdadb-0.3.6.dist-info}/RECORD +27 -24
- {lambdadb-0.3.5.dist-info → lambdadb-0.3.6.dist-info}/LICENSE +0 -0
- {lambdadb-0.3.5.dist-info → lambdadb-0.3.6.dist-info}/WHEEL +0 -0
lambdadb/collections.py
CHANGED
|
@@ -97,46 +97,37 @@ class Collections(BaseSDK):
|
|
|
97
97
|
|
|
98
98
|
response_data: Any = None
|
|
99
99
|
if utils.match_response(http_res, "200", "application/json"):
|
|
100
|
-
return utils.
|
|
100
|
+
return utils.unmarshal_json_response(
|
|
101
|
+
models.ListCollectionsResponse, http_res
|
|
102
|
+
)
|
|
101
103
|
if utils.match_response(http_res, "401", "application/json"):
|
|
102
|
-
response_data = utils.
|
|
103
|
-
|
|
104
|
+
response_data = utils.unmarshal_json_response(
|
|
105
|
+
errors.UnauthenticatedErrorData, http_res
|
|
104
106
|
)
|
|
105
|
-
raise errors.UnauthenticatedError(
|
|
107
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
106
108
|
if utils.match_response(http_res, "404", "application/json"):
|
|
107
|
-
response_data = utils.
|
|
108
|
-
|
|
109
|
+
response_data = utils.unmarshal_json_response(
|
|
110
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
109
111
|
)
|
|
110
|
-
raise errors.ResourceNotFoundError(
|
|
112
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
111
113
|
if utils.match_response(http_res, "429", "application/json"):
|
|
112
|
-
response_data = utils.
|
|
113
|
-
|
|
114
|
+
response_data = utils.unmarshal_json_response(
|
|
115
|
+
errors.TooManyRequestsErrorData, http_res
|
|
114
116
|
)
|
|
115
|
-
raise errors.TooManyRequestsError(
|
|
117
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
116
118
|
if utils.match_response(http_res, "500", "application/json"):
|
|
117
|
-
response_data = utils.
|
|
118
|
-
|
|
119
|
+
response_data = utils.unmarshal_json_response(
|
|
120
|
+
errors.InternalServerErrorData, http_res
|
|
119
121
|
)
|
|
120
|
-
raise errors.InternalServerError(
|
|
122
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
121
123
|
if utils.match_response(http_res, "4XX", "*"):
|
|
122
124
|
http_res_text = utils.stream_to_text(http_res)
|
|
123
|
-
raise errors.APIError(
|
|
124
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
125
|
-
)
|
|
125
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
126
126
|
if utils.match_response(http_res, "5XX", "*"):
|
|
127
127
|
http_res_text = utils.stream_to_text(http_res)
|
|
128
|
-
raise errors.APIError(
|
|
129
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
130
|
-
)
|
|
128
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
131
129
|
|
|
132
|
-
|
|
133
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
134
|
-
raise errors.APIError(
|
|
135
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
136
|
-
http_res.status_code,
|
|
137
|
-
http_res_text,
|
|
138
|
-
http_res,
|
|
139
|
-
)
|
|
130
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
140
131
|
|
|
141
132
|
async def list_async(
|
|
142
133
|
self,
|
|
@@ -214,46 +205,37 @@ class Collections(BaseSDK):
|
|
|
214
205
|
|
|
215
206
|
response_data: Any = None
|
|
216
207
|
if utils.match_response(http_res, "200", "application/json"):
|
|
217
|
-
return utils.
|
|
208
|
+
return utils.unmarshal_json_response(
|
|
209
|
+
models.ListCollectionsResponse, http_res
|
|
210
|
+
)
|
|
218
211
|
if utils.match_response(http_res, "401", "application/json"):
|
|
219
|
-
response_data = utils.
|
|
220
|
-
|
|
212
|
+
response_data = utils.unmarshal_json_response(
|
|
213
|
+
errors.UnauthenticatedErrorData, http_res
|
|
221
214
|
)
|
|
222
|
-
raise errors.UnauthenticatedError(
|
|
215
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
223
216
|
if utils.match_response(http_res, "404", "application/json"):
|
|
224
|
-
response_data = utils.
|
|
225
|
-
|
|
217
|
+
response_data = utils.unmarshal_json_response(
|
|
218
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
226
219
|
)
|
|
227
|
-
raise errors.ResourceNotFoundError(
|
|
220
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
228
221
|
if utils.match_response(http_res, "429", "application/json"):
|
|
229
|
-
response_data = utils.
|
|
230
|
-
|
|
222
|
+
response_data = utils.unmarshal_json_response(
|
|
223
|
+
errors.TooManyRequestsErrorData, http_res
|
|
231
224
|
)
|
|
232
|
-
raise errors.TooManyRequestsError(
|
|
225
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
233
226
|
if utils.match_response(http_res, "500", "application/json"):
|
|
234
|
-
response_data = utils.
|
|
235
|
-
|
|
227
|
+
response_data = utils.unmarshal_json_response(
|
|
228
|
+
errors.InternalServerErrorData, http_res
|
|
236
229
|
)
|
|
237
|
-
raise errors.InternalServerError(
|
|
230
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
238
231
|
if utils.match_response(http_res, "4XX", "*"):
|
|
239
232
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
240
|
-
raise errors.APIError(
|
|
241
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
242
|
-
)
|
|
233
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
243
234
|
if utils.match_response(http_res, "5XX", "*"):
|
|
244
235
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
245
|
-
raise errors.APIError(
|
|
246
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
247
|
-
)
|
|
236
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
248
237
|
|
|
249
|
-
|
|
250
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
251
|
-
raise errors.APIError(
|
|
252
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
253
|
-
http_res.status_code,
|
|
254
|
-
http_res_text,
|
|
255
|
-
http_res,
|
|
256
|
-
)
|
|
238
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
257
239
|
|
|
258
240
|
def create(
|
|
259
241
|
self,
|
|
@@ -365,51 +347,42 @@ class Collections(BaseSDK):
|
|
|
365
347
|
|
|
366
348
|
response_data: Any = None
|
|
367
349
|
if utils.match_response(http_res, "202", "application/json"):
|
|
368
|
-
return utils.
|
|
350
|
+
return utils.unmarshal_json_response(
|
|
351
|
+
models.CreateCollectionResponse, http_res
|
|
352
|
+
)
|
|
369
353
|
if utils.match_response(http_res, "400", "application/json"):
|
|
370
|
-
response_data = utils.
|
|
371
|
-
|
|
354
|
+
response_data = utils.unmarshal_json_response(
|
|
355
|
+
errors.BadRequestErrorData, http_res
|
|
372
356
|
)
|
|
373
|
-
raise errors.BadRequestError(
|
|
357
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
374
358
|
if utils.match_response(http_res, "401", "application/json"):
|
|
375
|
-
response_data = utils.
|
|
376
|
-
|
|
359
|
+
response_data = utils.unmarshal_json_response(
|
|
360
|
+
errors.UnauthenticatedErrorData, http_res
|
|
377
361
|
)
|
|
378
|
-
raise errors.UnauthenticatedError(
|
|
362
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
379
363
|
if utils.match_response(http_res, "409", "application/json"):
|
|
380
|
-
response_data = utils.
|
|
381
|
-
|
|
364
|
+
response_data = utils.unmarshal_json_response(
|
|
365
|
+
errors.ResourceAlreadyExistsErrorData, http_res
|
|
382
366
|
)
|
|
383
|
-
raise errors.ResourceAlreadyExistsError(
|
|
367
|
+
raise errors.ResourceAlreadyExistsError(response_data, http_res)
|
|
384
368
|
if utils.match_response(http_res, "429", "application/json"):
|
|
385
|
-
response_data = utils.
|
|
386
|
-
|
|
369
|
+
response_data = utils.unmarshal_json_response(
|
|
370
|
+
errors.TooManyRequestsErrorData, http_res
|
|
387
371
|
)
|
|
388
|
-
raise errors.TooManyRequestsError(
|
|
372
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
389
373
|
if utils.match_response(http_res, "500", "application/json"):
|
|
390
|
-
response_data = utils.
|
|
391
|
-
|
|
374
|
+
response_data = utils.unmarshal_json_response(
|
|
375
|
+
errors.InternalServerErrorData, http_res
|
|
392
376
|
)
|
|
393
|
-
raise errors.InternalServerError(
|
|
377
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
394
378
|
if utils.match_response(http_res, "4XX", "*"):
|
|
395
379
|
http_res_text = utils.stream_to_text(http_res)
|
|
396
|
-
raise errors.APIError(
|
|
397
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
398
|
-
)
|
|
380
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
399
381
|
if utils.match_response(http_res, "5XX", "*"):
|
|
400
382
|
http_res_text = utils.stream_to_text(http_res)
|
|
401
|
-
raise errors.APIError(
|
|
402
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
403
|
-
)
|
|
383
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
404
384
|
|
|
405
|
-
|
|
406
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
407
|
-
raise errors.APIError(
|
|
408
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
409
|
-
http_res.status_code,
|
|
410
|
-
http_res_text,
|
|
411
|
-
http_res,
|
|
412
|
-
)
|
|
385
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
413
386
|
|
|
414
387
|
async def create_async(
|
|
415
388
|
self,
|
|
@@ -521,51 +494,42 @@ class Collections(BaseSDK):
|
|
|
521
494
|
|
|
522
495
|
response_data: Any = None
|
|
523
496
|
if utils.match_response(http_res, "202", "application/json"):
|
|
524
|
-
return utils.
|
|
497
|
+
return utils.unmarshal_json_response(
|
|
498
|
+
models.CreateCollectionResponse, http_res
|
|
499
|
+
)
|
|
525
500
|
if utils.match_response(http_res, "400", "application/json"):
|
|
526
|
-
response_data = utils.
|
|
527
|
-
|
|
501
|
+
response_data = utils.unmarshal_json_response(
|
|
502
|
+
errors.BadRequestErrorData, http_res
|
|
528
503
|
)
|
|
529
|
-
raise errors.BadRequestError(
|
|
504
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
530
505
|
if utils.match_response(http_res, "401", "application/json"):
|
|
531
|
-
response_data = utils.
|
|
532
|
-
|
|
506
|
+
response_data = utils.unmarshal_json_response(
|
|
507
|
+
errors.UnauthenticatedErrorData, http_res
|
|
533
508
|
)
|
|
534
|
-
raise errors.UnauthenticatedError(
|
|
509
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
535
510
|
if utils.match_response(http_res, "409", "application/json"):
|
|
536
|
-
response_data = utils.
|
|
537
|
-
|
|
511
|
+
response_data = utils.unmarshal_json_response(
|
|
512
|
+
errors.ResourceAlreadyExistsErrorData, http_res
|
|
538
513
|
)
|
|
539
|
-
raise errors.ResourceAlreadyExistsError(
|
|
514
|
+
raise errors.ResourceAlreadyExistsError(response_data, http_res)
|
|
540
515
|
if utils.match_response(http_res, "429", "application/json"):
|
|
541
|
-
response_data = utils.
|
|
542
|
-
|
|
516
|
+
response_data = utils.unmarshal_json_response(
|
|
517
|
+
errors.TooManyRequestsErrorData, http_res
|
|
543
518
|
)
|
|
544
|
-
raise errors.TooManyRequestsError(
|
|
519
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
545
520
|
if utils.match_response(http_res, "500", "application/json"):
|
|
546
|
-
response_data = utils.
|
|
547
|
-
|
|
521
|
+
response_data = utils.unmarshal_json_response(
|
|
522
|
+
errors.InternalServerErrorData, http_res
|
|
548
523
|
)
|
|
549
|
-
raise errors.InternalServerError(
|
|
524
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
550
525
|
if utils.match_response(http_res, "4XX", "*"):
|
|
551
526
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
552
|
-
raise errors.APIError(
|
|
553
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
554
|
-
)
|
|
527
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
555
528
|
if utils.match_response(http_res, "5XX", "*"):
|
|
556
529
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
557
|
-
raise errors.APIError(
|
|
558
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
559
|
-
)
|
|
530
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
560
531
|
|
|
561
|
-
|
|
562
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
563
|
-
raise errors.APIError(
|
|
564
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
565
|
-
http_res.status_code,
|
|
566
|
-
http_res_text,
|
|
567
|
-
http_res,
|
|
568
|
-
)
|
|
532
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
569
533
|
|
|
570
534
|
def delete(
|
|
571
535
|
self,
|
|
@@ -646,46 +610,35 @@ class Collections(BaseSDK):
|
|
|
646
610
|
|
|
647
611
|
response_data: Any = None
|
|
648
612
|
if utils.match_response(http_res, "202", "application/json"):
|
|
649
|
-
return utils.
|
|
613
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
650
614
|
if utils.match_response(http_res, "401", "application/json"):
|
|
651
|
-
response_data = utils.
|
|
652
|
-
|
|
615
|
+
response_data = utils.unmarshal_json_response(
|
|
616
|
+
errors.UnauthenticatedErrorData, http_res
|
|
653
617
|
)
|
|
654
|
-
raise errors.UnauthenticatedError(
|
|
618
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
655
619
|
if utils.match_response(http_res, "404", "application/json"):
|
|
656
|
-
response_data = utils.
|
|
657
|
-
|
|
620
|
+
response_data = utils.unmarshal_json_response(
|
|
621
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
658
622
|
)
|
|
659
|
-
raise errors.ResourceNotFoundError(
|
|
623
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
660
624
|
if utils.match_response(http_res, "429", "application/json"):
|
|
661
|
-
response_data = utils.
|
|
662
|
-
|
|
625
|
+
response_data = utils.unmarshal_json_response(
|
|
626
|
+
errors.TooManyRequestsErrorData, http_res
|
|
663
627
|
)
|
|
664
|
-
raise errors.TooManyRequestsError(
|
|
628
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
665
629
|
if utils.match_response(http_res, "500", "application/json"):
|
|
666
|
-
response_data = utils.
|
|
667
|
-
|
|
630
|
+
response_data = utils.unmarshal_json_response(
|
|
631
|
+
errors.InternalServerErrorData, http_res
|
|
668
632
|
)
|
|
669
|
-
raise errors.InternalServerError(
|
|
633
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
670
634
|
if utils.match_response(http_res, "4XX", "*"):
|
|
671
635
|
http_res_text = utils.stream_to_text(http_res)
|
|
672
|
-
raise errors.APIError(
|
|
673
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
674
|
-
)
|
|
636
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
675
637
|
if utils.match_response(http_res, "5XX", "*"):
|
|
676
638
|
http_res_text = utils.stream_to_text(http_res)
|
|
677
|
-
raise errors.APIError(
|
|
678
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
679
|
-
)
|
|
639
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
680
640
|
|
|
681
|
-
|
|
682
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
683
|
-
raise errors.APIError(
|
|
684
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
685
|
-
http_res.status_code,
|
|
686
|
-
http_res_text,
|
|
687
|
-
http_res,
|
|
688
|
-
)
|
|
641
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
689
642
|
|
|
690
643
|
async def delete_async(
|
|
691
644
|
self,
|
|
@@ -766,46 +719,35 @@ class Collections(BaseSDK):
|
|
|
766
719
|
|
|
767
720
|
response_data: Any = None
|
|
768
721
|
if utils.match_response(http_res, "202", "application/json"):
|
|
769
|
-
return utils.
|
|
722
|
+
return utils.unmarshal_json_response(models.MessageResponse, http_res)
|
|
770
723
|
if utils.match_response(http_res, "401", "application/json"):
|
|
771
|
-
response_data = utils.
|
|
772
|
-
|
|
724
|
+
response_data = utils.unmarshal_json_response(
|
|
725
|
+
errors.UnauthenticatedErrorData, http_res
|
|
773
726
|
)
|
|
774
|
-
raise errors.UnauthenticatedError(
|
|
727
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
775
728
|
if utils.match_response(http_res, "404", "application/json"):
|
|
776
|
-
response_data = utils.
|
|
777
|
-
|
|
729
|
+
response_data = utils.unmarshal_json_response(
|
|
730
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
778
731
|
)
|
|
779
|
-
raise errors.ResourceNotFoundError(
|
|
732
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
780
733
|
if utils.match_response(http_res, "429", "application/json"):
|
|
781
|
-
response_data = utils.
|
|
782
|
-
|
|
734
|
+
response_data = utils.unmarshal_json_response(
|
|
735
|
+
errors.TooManyRequestsErrorData, http_res
|
|
783
736
|
)
|
|
784
|
-
raise errors.TooManyRequestsError(
|
|
737
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
785
738
|
if utils.match_response(http_res, "500", "application/json"):
|
|
786
|
-
response_data = utils.
|
|
787
|
-
|
|
739
|
+
response_data = utils.unmarshal_json_response(
|
|
740
|
+
errors.InternalServerErrorData, http_res
|
|
788
741
|
)
|
|
789
|
-
raise errors.InternalServerError(
|
|
742
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
790
743
|
if utils.match_response(http_res, "4XX", "*"):
|
|
791
744
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
792
|
-
raise errors.APIError(
|
|
793
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
794
|
-
)
|
|
745
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
795
746
|
if utils.match_response(http_res, "5XX", "*"):
|
|
796
747
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
797
|
-
raise errors.APIError(
|
|
798
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
799
|
-
)
|
|
748
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
800
749
|
|
|
801
|
-
|
|
802
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
803
|
-
raise errors.APIError(
|
|
804
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
805
|
-
http_res.status_code,
|
|
806
|
-
http_res_text,
|
|
807
|
-
http_res,
|
|
808
|
-
)
|
|
750
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
809
751
|
|
|
810
752
|
def get(
|
|
811
753
|
self,
|
|
@@ -886,46 +828,35 @@ class Collections(BaseSDK):
|
|
|
886
828
|
|
|
887
829
|
response_data: Any = None
|
|
888
830
|
if utils.match_response(http_res, "200", "application/json"):
|
|
889
|
-
return utils.
|
|
831
|
+
return utils.unmarshal_json_response(models.GetCollectionResponse, http_res)
|
|
890
832
|
if utils.match_response(http_res, "401", "application/json"):
|
|
891
|
-
response_data = utils.
|
|
892
|
-
|
|
833
|
+
response_data = utils.unmarshal_json_response(
|
|
834
|
+
errors.UnauthenticatedErrorData, http_res
|
|
893
835
|
)
|
|
894
|
-
raise errors.UnauthenticatedError(
|
|
836
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
895
837
|
if utils.match_response(http_res, "404", "application/json"):
|
|
896
|
-
response_data = utils.
|
|
897
|
-
|
|
838
|
+
response_data = utils.unmarshal_json_response(
|
|
839
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
898
840
|
)
|
|
899
|
-
raise errors.ResourceNotFoundError(
|
|
841
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
900
842
|
if utils.match_response(http_res, "429", "application/json"):
|
|
901
|
-
response_data = utils.
|
|
902
|
-
|
|
843
|
+
response_data = utils.unmarshal_json_response(
|
|
844
|
+
errors.TooManyRequestsErrorData, http_res
|
|
903
845
|
)
|
|
904
|
-
raise errors.TooManyRequestsError(
|
|
846
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
905
847
|
if utils.match_response(http_res, "500", "application/json"):
|
|
906
|
-
response_data = utils.
|
|
907
|
-
|
|
848
|
+
response_data = utils.unmarshal_json_response(
|
|
849
|
+
errors.InternalServerErrorData, http_res
|
|
908
850
|
)
|
|
909
|
-
raise errors.InternalServerError(
|
|
851
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
910
852
|
if utils.match_response(http_res, "4XX", "*"):
|
|
911
853
|
http_res_text = utils.stream_to_text(http_res)
|
|
912
|
-
raise errors.APIError(
|
|
913
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
914
|
-
)
|
|
854
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
915
855
|
if utils.match_response(http_res, "5XX", "*"):
|
|
916
856
|
http_res_text = utils.stream_to_text(http_res)
|
|
917
|
-
raise errors.APIError(
|
|
918
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
919
|
-
)
|
|
857
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
920
858
|
|
|
921
|
-
|
|
922
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
923
|
-
raise errors.APIError(
|
|
924
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
925
|
-
http_res.status_code,
|
|
926
|
-
http_res_text,
|
|
927
|
-
http_res,
|
|
928
|
-
)
|
|
859
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
929
860
|
|
|
930
861
|
async def get_async(
|
|
931
862
|
self,
|
|
@@ -1006,46 +937,35 @@ class Collections(BaseSDK):
|
|
|
1006
937
|
|
|
1007
938
|
response_data: Any = None
|
|
1008
939
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1009
|
-
return utils.
|
|
940
|
+
return utils.unmarshal_json_response(models.GetCollectionResponse, http_res)
|
|
1010
941
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1011
|
-
response_data = utils.
|
|
1012
|
-
|
|
942
|
+
response_data = utils.unmarshal_json_response(
|
|
943
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1013
944
|
)
|
|
1014
|
-
raise errors.UnauthenticatedError(
|
|
945
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1015
946
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1016
|
-
response_data = utils.
|
|
1017
|
-
|
|
947
|
+
response_data = utils.unmarshal_json_response(
|
|
948
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1018
949
|
)
|
|
1019
|
-
raise errors.ResourceNotFoundError(
|
|
950
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1020
951
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1021
|
-
response_data = utils.
|
|
1022
|
-
|
|
952
|
+
response_data = utils.unmarshal_json_response(
|
|
953
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1023
954
|
)
|
|
1024
|
-
raise errors.TooManyRequestsError(
|
|
955
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1025
956
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1026
|
-
response_data = utils.
|
|
1027
|
-
|
|
957
|
+
response_data = utils.unmarshal_json_response(
|
|
958
|
+
errors.InternalServerErrorData, http_res
|
|
1028
959
|
)
|
|
1029
|
-
raise errors.InternalServerError(
|
|
960
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1030
961
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1031
962
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1032
|
-
raise errors.APIError(
|
|
1033
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1034
|
-
)
|
|
963
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1035
964
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1036
965
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1037
|
-
raise errors.APIError(
|
|
1038
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1039
|
-
)
|
|
966
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1040
967
|
|
|
1041
|
-
|
|
1042
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1043
|
-
raise errors.APIError(
|
|
1044
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1045
|
-
http_res.status_code,
|
|
1046
|
-
http_res_text,
|
|
1047
|
-
http_res,
|
|
1048
|
-
)
|
|
968
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1049
969
|
|
|
1050
970
|
def update(
|
|
1051
971
|
self,
|
|
@@ -1143,51 +1063,42 @@ class Collections(BaseSDK):
|
|
|
1143
1063
|
|
|
1144
1064
|
response_data: Any = None
|
|
1145
1065
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1146
|
-
return utils.
|
|
1066
|
+
return utils.unmarshal_json_response(
|
|
1067
|
+
models.UpdateCollectionResponse, http_res
|
|
1068
|
+
)
|
|
1147
1069
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1148
|
-
response_data = utils.
|
|
1149
|
-
|
|
1070
|
+
response_data = utils.unmarshal_json_response(
|
|
1071
|
+
errors.BadRequestErrorData, http_res
|
|
1150
1072
|
)
|
|
1151
|
-
raise errors.BadRequestError(
|
|
1073
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1152
1074
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1153
|
-
response_data = utils.
|
|
1154
|
-
|
|
1075
|
+
response_data = utils.unmarshal_json_response(
|
|
1076
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1155
1077
|
)
|
|
1156
|
-
raise errors.UnauthenticatedError(
|
|
1078
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1157
1079
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1158
|
-
response_data = utils.
|
|
1159
|
-
|
|
1080
|
+
response_data = utils.unmarshal_json_response(
|
|
1081
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1160
1082
|
)
|
|
1161
|
-
raise errors.ResourceNotFoundError(
|
|
1083
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1162
1084
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1163
|
-
response_data = utils.
|
|
1164
|
-
|
|
1085
|
+
response_data = utils.unmarshal_json_response(
|
|
1086
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1165
1087
|
)
|
|
1166
|
-
raise errors.TooManyRequestsError(
|
|
1088
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1167
1089
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1168
|
-
response_data = utils.
|
|
1169
|
-
|
|
1090
|
+
response_data = utils.unmarshal_json_response(
|
|
1091
|
+
errors.InternalServerErrorData, http_res
|
|
1170
1092
|
)
|
|
1171
|
-
raise errors.InternalServerError(
|
|
1093
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1172
1094
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1173
1095
|
http_res_text = utils.stream_to_text(http_res)
|
|
1174
|
-
raise errors.APIError(
|
|
1175
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1176
|
-
)
|
|
1096
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1177
1097
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1178
1098
|
http_res_text = utils.stream_to_text(http_res)
|
|
1179
|
-
raise errors.APIError(
|
|
1180
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1181
|
-
)
|
|
1099
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1182
1100
|
|
|
1183
|
-
|
|
1184
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1185
|
-
raise errors.APIError(
|
|
1186
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1187
|
-
http_res.status_code,
|
|
1188
|
-
http_res_text,
|
|
1189
|
-
http_res,
|
|
1190
|
-
)
|
|
1101
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1191
1102
|
|
|
1192
1103
|
async def update_async(
|
|
1193
1104
|
self,
|
|
@@ -1285,51 +1196,42 @@ class Collections(BaseSDK):
|
|
|
1285
1196
|
|
|
1286
1197
|
response_data: Any = None
|
|
1287
1198
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1288
|
-
return utils.
|
|
1199
|
+
return utils.unmarshal_json_response(
|
|
1200
|
+
models.UpdateCollectionResponse, http_res
|
|
1201
|
+
)
|
|
1289
1202
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1290
|
-
response_data = utils.
|
|
1291
|
-
|
|
1203
|
+
response_data = utils.unmarshal_json_response(
|
|
1204
|
+
errors.BadRequestErrorData, http_res
|
|
1292
1205
|
)
|
|
1293
|
-
raise errors.BadRequestError(
|
|
1206
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1294
1207
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1295
|
-
response_data = utils.
|
|
1296
|
-
|
|
1208
|
+
response_data = utils.unmarshal_json_response(
|
|
1209
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1297
1210
|
)
|
|
1298
|
-
raise errors.UnauthenticatedError(
|
|
1211
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1299
1212
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1300
|
-
response_data = utils.
|
|
1301
|
-
|
|
1213
|
+
response_data = utils.unmarshal_json_response(
|
|
1214
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1302
1215
|
)
|
|
1303
|
-
raise errors.ResourceNotFoundError(
|
|
1216
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1304
1217
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1305
|
-
response_data = utils.
|
|
1306
|
-
|
|
1218
|
+
response_data = utils.unmarshal_json_response(
|
|
1219
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1307
1220
|
)
|
|
1308
|
-
raise errors.TooManyRequestsError(
|
|
1221
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1309
1222
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1310
|
-
response_data = utils.
|
|
1311
|
-
|
|
1223
|
+
response_data = utils.unmarshal_json_response(
|
|
1224
|
+
errors.InternalServerErrorData, http_res
|
|
1312
1225
|
)
|
|
1313
|
-
raise errors.InternalServerError(
|
|
1226
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1314
1227
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1315
1228
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1316
|
-
raise errors.APIError(
|
|
1317
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1318
|
-
)
|
|
1229
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1319
1230
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1320
1231
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1321
|
-
raise errors.APIError(
|
|
1322
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1323
|
-
)
|
|
1232
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1324
1233
|
|
|
1325
|
-
|
|
1326
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1327
|
-
raise errors.APIError(
|
|
1328
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1329
|
-
http_res.status_code,
|
|
1330
|
-
http_res_text,
|
|
1331
|
-
http_res,
|
|
1332
|
-
)
|
|
1234
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1333
1235
|
|
|
1334
1236
|
def query(
|
|
1335
1237
|
self,
|
|
@@ -1337,10 +1239,10 @@ class Collections(BaseSDK):
|
|
|
1337
1239
|
project_name: str,
|
|
1338
1240
|
collection_name: str,
|
|
1339
1241
|
size: int,
|
|
1340
|
-
query: Optional[
|
|
1242
|
+
query: Optional[Dict[str, Any]] = None,
|
|
1341
1243
|
consistent_read: Optional[bool] = False,
|
|
1342
1244
|
include_vectors: Optional[bool] = False,
|
|
1343
|
-
sort: Optional[
|
|
1245
|
+
sort: Optional[List[Dict[str, Any]]] = None,
|
|
1344
1246
|
fields: Optional[List[str]] = None,
|
|
1345
1247
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1346
1248
|
server_url: Optional[str] = None,
|
|
@@ -1377,10 +1279,10 @@ class Collections(BaseSDK):
|
|
|
1377
1279
|
collection_name=collection_name,
|
|
1378
1280
|
request_body=models.QueryCollectionRequestBody(
|
|
1379
1281
|
size=size,
|
|
1380
|
-
query=
|
|
1282
|
+
query=query,
|
|
1381
1283
|
consistent_read=consistent_read,
|
|
1382
1284
|
include_vectors=include_vectors,
|
|
1383
|
-
sort=
|
|
1285
|
+
sort=sort,
|
|
1384
1286
|
fields=fields,
|
|
1385
1287
|
),
|
|
1386
1288
|
)
|
|
@@ -1437,51 +1339,42 @@ class Collections(BaseSDK):
|
|
|
1437
1339
|
|
|
1438
1340
|
response_data: Any = None
|
|
1439
1341
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1440
|
-
return utils.
|
|
1342
|
+
return utils.unmarshal_json_response(
|
|
1343
|
+
models.QueryCollectionResponse, http_res
|
|
1344
|
+
)
|
|
1441
1345
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1442
|
-
response_data = utils.
|
|
1443
|
-
|
|
1346
|
+
response_data = utils.unmarshal_json_response(
|
|
1347
|
+
errors.BadRequestErrorData, http_res
|
|
1444
1348
|
)
|
|
1445
|
-
raise errors.BadRequestError(
|
|
1349
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1446
1350
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1447
|
-
response_data = utils.
|
|
1448
|
-
|
|
1351
|
+
response_data = utils.unmarshal_json_response(
|
|
1352
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1449
1353
|
)
|
|
1450
|
-
raise errors.UnauthenticatedError(
|
|
1354
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1451
1355
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1452
|
-
response_data = utils.
|
|
1453
|
-
|
|
1356
|
+
response_data = utils.unmarshal_json_response(
|
|
1357
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1454
1358
|
)
|
|
1455
|
-
raise errors.ResourceNotFoundError(
|
|
1359
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1456
1360
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1457
|
-
response_data = utils.
|
|
1458
|
-
|
|
1361
|
+
response_data = utils.unmarshal_json_response(
|
|
1362
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1459
1363
|
)
|
|
1460
|
-
raise errors.TooManyRequestsError(
|
|
1364
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1461
1365
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1462
|
-
response_data = utils.
|
|
1463
|
-
|
|
1366
|
+
response_data = utils.unmarshal_json_response(
|
|
1367
|
+
errors.InternalServerErrorData, http_res
|
|
1464
1368
|
)
|
|
1465
|
-
raise errors.InternalServerError(
|
|
1369
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1466
1370
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1467
1371
|
http_res_text = utils.stream_to_text(http_res)
|
|
1468
|
-
raise errors.APIError(
|
|
1469
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1470
|
-
)
|
|
1372
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1471
1373
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1472
1374
|
http_res_text = utils.stream_to_text(http_res)
|
|
1473
|
-
raise errors.APIError(
|
|
1474
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1475
|
-
)
|
|
1375
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1476
1376
|
|
|
1477
|
-
|
|
1478
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1479
|
-
raise errors.APIError(
|
|
1480
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1481
|
-
http_res.status_code,
|
|
1482
|
-
http_res_text,
|
|
1483
|
-
http_res,
|
|
1484
|
-
)
|
|
1377
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1485
1378
|
|
|
1486
1379
|
async def query_async(
|
|
1487
1380
|
self,
|
|
@@ -1489,10 +1382,10 @@ class Collections(BaseSDK):
|
|
|
1489
1382
|
project_name: str,
|
|
1490
1383
|
collection_name: str,
|
|
1491
1384
|
size: int,
|
|
1492
|
-
query: Optional[
|
|
1385
|
+
query: Optional[Dict[str, Any]] = None,
|
|
1493
1386
|
consistent_read: Optional[bool] = False,
|
|
1494
1387
|
include_vectors: Optional[bool] = False,
|
|
1495
|
-
sort: Optional[
|
|
1388
|
+
sort: Optional[List[Dict[str, Any]]] = None,
|
|
1496
1389
|
fields: Optional[List[str]] = None,
|
|
1497
1390
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1498
1391
|
server_url: Optional[str] = None,
|
|
@@ -1529,10 +1422,10 @@ class Collections(BaseSDK):
|
|
|
1529
1422
|
collection_name=collection_name,
|
|
1530
1423
|
request_body=models.QueryCollectionRequestBody(
|
|
1531
1424
|
size=size,
|
|
1532
|
-
query=
|
|
1425
|
+
query=query,
|
|
1533
1426
|
consistent_read=consistent_read,
|
|
1534
1427
|
include_vectors=include_vectors,
|
|
1535
|
-
sort=
|
|
1428
|
+
sort=sort,
|
|
1536
1429
|
fields=fields,
|
|
1537
1430
|
),
|
|
1538
1431
|
)
|
|
@@ -1589,48 +1482,39 @@ class Collections(BaseSDK):
|
|
|
1589
1482
|
|
|
1590
1483
|
response_data: Any = None
|
|
1591
1484
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1592
|
-
return utils.
|
|
1485
|
+
return utils.unmarshal_json_response(
|
|
1486
|
+
models.QueryCollectionResponse, http_res
|
|
1487
|
+
)
|
|
1593
1488
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1594
|
-
response_data = utils.
|
|
1595
|
-
|
|
1489
|
+
response_data = utils.unmarshal_json_response(
|
|
1490
|
+
errors.BadRequestErrorData, http_res
|
|
1596
1491
|
)
|
|
1597
|
-
raise errors.BadRequestError(
|
|
1492
|
+
raise errors.BadRequestError(response_data, http_res)
|
|
1598
1493
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1599
|
-
response_data = utils.
|
|
1600
|
-
|
|
1494
|
+
response_data = utils.unmarshal_json_response(
|
|
1495
|
+
errors.UnauthenticatedErrorData, http_res
|
|
1601
1496
|
)
|
|
1602
|
-
raise errors.UnauthenticatedError(
|
|
1497
|
+
raise errors.UnauthenticatedError(response_data, http_res)
|
|
1603
1498
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1604
|
-
response_data = utils.
|
|
1605
|
-
|
|
1499
|
+
response_data = utils.unmarshal_json_response(
|
|
1500
|
+
errors.ResourceNotFoundErrorData, http_res
|
|
1606
1501
|
)
|
|
1607
|
-
raise errors.ResourceNotFoundError(
|
|
1502
|
+
raise errors.ResourceNotFoundError(response_data, http_res)
|
|
1608
1503
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1609
|
-
response_data = utils.
|
|
1610
|
-
|
|
1504
|
+
response_data = utils.unmarshal_json_response(
|
|
1505
|
+
errors.TooManyRequestsErrorData, http_res
|
|
1611
1506
|
)
|
|
1612
|
-
raise errors.TooManyRequestsError(
|
|
1507
|
+
raise errors.TooManyRequestsError(response_data, http_res)
|
|
1613
1508
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1614
|
-
response_data = utils.
|
|
1615
|
-
|
|
1509
|
+
response_data = utils.unmarshal_json_response(
|
|
1510
|
+
errors.InternalServerErrorData, http_res
|
|
1616
1511
|
)
|
|
1617
|
-
raise errors.InternalServerError(
|
|
1512
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1618
1513
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1619
1514
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1620
|
-
raise errors.APIError(
|
|
1621
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1622
|
-
)
|
|
1515
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1623
1516
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1624
1517
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1625
|
-
raise errors.APIError(
|
|
1626
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1627
|
-
)
|
|
1518
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1628
1519
|
|
|
1629
|
-
|
|
1630
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1631
|
-
raise errors.APIError(
|
|
1632
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1633
|
-
http_res.status_code,
|
|
1634
|
-
http_res_text,
|
|
1635
|
-
http_res,
|
|
1636
|
-
)
|
|
1520
|
+
raise errors.APIError("Unexpected response received", http_res)
|