latitudesh-python-sdk 2.0.0__py3-none-any.whl → 2.0.1__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 latitudesh-python-sdk might be problematic. Click here for more details.

Files changed (43) hide show
  1. latitudesh_python_sdk/_version.py +3 -3
  2. latitudesh_python_sdk/apikeys.py +51 -138
  3. latitudesh_python_sdk/basesdk.py +4 -4
  4. latitudesh_python_sdk/billing.py +11 -32
  5. latitudesh_python_sdk/events_sdk.py +9 -34
  6. latitudesh_python_sdk/firewalls_sdk.py +89 -264
  7. latitudesh_python_sdk/ipaddresses_sdk.py +25 -68
  8. latitudesh_python_sdk/models/__init__.py +27 -4
  9. latitudesh_python_sdk/models/apierror.py +30 -14
  10. latitudesh_python_sdk/models/deploy_config.py +11 -6
  11. latitudesh_python_sdk/models/error_object.py +11 -6
  12. latitudesh_python_sdk/models/latitudesherror.py +26 -0
  13. latitudesh_python_sdk/models/no_response_error.py +13 -0
  14. latitudesh_python_sdk/models/region_resource_data.py +4 -4
  15. latitudesh_python_sdk/models/responsevalidationerror.py +25 -0
  16. latitudesh_python_sdk/models/server.py +11 -6
  17. latitudesh_python_sdk/models/server_data.py +6 -3
  18. latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
  19. latitudesh_python_sdk/models/update_serverop.py +1 -3
  20. latitudesh_python_sdk/models/virtual_network.py +11 -6
  21. latitudesh_python_sdk/operatingsystems_sdk.py +11 -32
  22. latitudesh_python_sdk/plans.py +57 -188
  23. latitudesh_python_sdk/privatenetworks.py +87 -262
  24. latitudesh_python_sdk/projects_sdk.py +43 -130
  25. latitudesh_python_sdk/regions_sdk.py +21 -66
  26. latitudesh_python_sdk/roles.py +21 -64
  27. latitudesh_python_sdk/servers_sdk.py +207 -604
  28. latitudesh_python_sdk/sshkeys_sdk.py +85 -304
  29. latitudesh_python_sdk/storage.py +33 -120
  30. latitudesh_python_sdk/tags.py +39 -126
  31. latitudesh_python_sdk/teams_sdk.py +35 -100
  32. latitudesh_python_sdk/teamsmembers.py +31 -96
  33. latitudesh_python_sdk/traffic_sdk.py +25 -68
  34. latitudesh_python_sdk/userdata_sdk.py +79 -298
  35. latitudesh_python_sdk/userprofile.py +31 -100
  36. latitudesh_python_sdk/utils/serializers.py +3 -2
  37. latitudesh_python_sdk/utils/unmarshal_json_response.py +24 -0
  38. latitudesh_python_sdk/virtualmachines.py +35 -122
  39. latitudesh_python_sdk/vpnsessions.py +55 -146
  40. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/METADATA +47 -24
  41. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/RECORD +43 -38
  42. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/LICENSE +0 -0
  43. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/WHEEL +0 -0
@@ -5,6 +5,7 @@ from latitudesh_python_sdk import models, utils
5
5
  from latitudesh_python_sdk._hooks import HookContext
6
6
  from latitudesh_python_sdk.types import OptionalNullable, UNSET
7
7
  from latitudesh_python_sdk.utils import get_security_from_env
8
+ from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
8
9
  from typing import Mapping, Optional, Union
9
10
 
10
11
 
@@ -94,28 +95,17 @@ class Storage(BaseSDK):
94
95
  )
95
96
 
96
97
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
97
- return utils.unmarshal_json(
98
- http_res.text, models.PostStorageFilesystemsResponseBody
98
+ return unmarshal_json_response(
99
+ models.PostStorageFilesystemsResponseBody, http_res
99
100
  )
100
101
  if utils.match_response(http_res, ["403", "409", "422", "4XX"], "*"):
101
102
  http_res_text = utils.stream_to_text(http_res)
102
- raise models.APIError(
103
- "API error occurred", http_res.status_code, http_res_text, http_res
104
- )
103
+ raise models.APIError("API error occurred", http_res, http_res_text)
105
104
  if utils.match_response(http_res, "5XX", "*"):
106
105
  http_res_text = utils.stream_to_text(http_res)
107
- raise models.APIError(
108
- "API error occurred", http_res.status_code, http_res_text, http_res
109
- )
106
+ raise models.APIError("API error occurred", http_res, http_res_text)
110
107
 
111
- content_type = http_res.headers.get("Content-Type")
112
- http_res_text = utils.stream_to_text(http_res)
113
- raise models.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
- )
108
+ raise models.APIError("Unexpected response received", http_res)
119
109
 
120
110
  async def create_filesystem_async(
121
111
  self,
@@ -202,28 +192,17 @@ class Storage(BaseSDK):
202
192
  )
203
193
 
204
194
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
205
- return utils.unmarshal_json(
206
- http_res.text, models.PostStorageFilesystemsResponseBody
195
+ return unmarshal_json_response(
196
+ models.PostStorageFilesystemsResponseBody, http_res
207
197
  )
208
198
  if utils.match_response(http_res, ["403", "409", "422", "4XX"], "*"):
209
199
  http_res_text = await utils.stream_to_text_async(http_res)
210
- raise models.APIError(
211
- "API error occurred", http_res.status_code, http_res_text, http_res
212
- )
200
+ raise models.APIError("API error occurred", http_res, http_res_text)
213
201
  if utils.match_response(http_res, "5XX", "*"):
214
202
  http_res_text = await utils.stream_to_text_async(http_res)
215
- raise models.APIError(
216
- "API error occurred", http_res.status_code, http_res_text, http_res
217
- )
203
+ raise models.APIError("API error occurred", http_res, http_res_text)
218
204
 
219
- content_type = http_res.headers.get("Content-Type")
220
- http_res_text = await utils.stream_to_text_async(http_res)
221
- raise models.APIError(
222
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
223
- http_res.status_code,
224
- http_res_text,
225
- http_res,
226
- )
205
+ raise models.APIError("Unexpected response received", http_res)
227
206
 
228
207
  def list_filesystems(
229
208
  self,
@@ -301,23 +280,12 @@ class Storage(BaseSDK):
301
280
  return
302
281
  if utils.match_response(http_res, "4XX", "*"):
303
282
  http_res_text = utils.stream_to_text(http_res)
304
- raise models.APIError(
305
- "API error occurred", http_res.status_code, http_res_text, http_res
306
- )
283
+ raise models.APIError("API error occurred", http_res, http_res_text)
307
284
  if utils.match_response(http_res, "5XX", "*"):
308
285
  http_res_text = utils.stream_to_text(http_res)
309
- raise models.APIError(
310
- "API error occurred", http_res.status_code, http_res_text, http_res
311
- )
286
+ raise models.APIError("API error occurred", http_res, http_res_text)
312
287
 
313
- content_type = http_res.headers.get("Content-Type")
314
- http_res_text = utils.stream_to_text(http_res)
315
- raise models.APIError(
316
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
317
- http_res.status_code,
318
- http_res_text,
319
- http_res,
320
- )
288
+ raise models.APIError("Unexpected response received", http_res)
321
289
 
322
290
  async def list_filesystems_async(
323
291
  self,
@@ -395,23 +363,12 @@ class Storage(BaseSDK):
395
363
  return
396
364
  if utils.match_response(http_res, "4XX", "*"):
397
365
  http_res_text = await utils.stream_to_text_async(http_res)
398
- raise models.APIError(
399
- "API error occurred", http_res.status_code, http_res_text, http_res
400
- )
366
+ raise models.APIError("API error occurred", http_res, http_res_text)
401
367
  if utils.match_response(http_res, "5XX", "*"):
402
368
  http_res_text = await utils.stream_to_text_async(http_res)
403
- raise models.APIError(
404
- "API error occurred", http_res.status_code, http_res_text, http_res
405
- )
369
+ raise models.APIError("API error occurred", http_res, http_res_text)
406
370
 
407
- content_type = http_res.headers.get("Content-Type")
408
- http_res_text = await utils.stream_to_text_async(http_res)
409
- raise models.APIError(
410
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
411
- http_res.status_code,
412
- http_res_text,
413
- http_res,
414
- )
371
+ raise models.APIError("Unexpected response received", http_res)
415
372
 
416
373
  def delete_filesystem(
417
374
  self,
@@ -489,23 +446,12 @@ class Storage(BaseSDK):
489
446
  return
490
447
  if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
491
448
  http_res_text = utils.stream_to_text(http_res)
492
- raise models.APIError(
493
- "API error occurred", http_res.status_code, http_res_text, http_res
494
- )
449
+ raise models.APIError("API error occurred", http_res, http_res_text)
495
450
  if utils.match_response(http_res, "5XX", "*"):
496
451
  http_res_text = utils.stream_to_text(http_res)
497
- raise models.APIError(
498
- "API error occurred", http_res.status_code, http_res_text, http_res
499
- )
452
+ raise models.APIError("API error occurred", http_res, http_res_text)
500
453
 
501
- content_type = http_res.headers.get("Content-Type")
502
- http_res_text = utils.stream_to_text(http_res)
503
- raise models.APIError(
504
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
505
- http_res.status_code,
506
- http_res_text,
507
- http_res,
508
- )
454
+ raise models.APIError("Unexpected response received", http_res)
509
455
 
510
456
  async def delete_filesystem_async(
511
457
  self,
@@ -583,23 +529,12 @@ class Storage(BaseSDK):
583
529
  return
584
530
  if utils.match_response(http_res, ["403", "404", "4XX"], "*"):
585
531
  http_res_text = await utils.stream_to_text_async(http_res)
586
- raise models.APIError(
587
- "API error occurred", http_res.status_code, http_res_text, http_res
588
- )
532
+ raise models.APIError("API error occurred", http_res, http_res_text)
589
533
  if utils.match_response(http_res, "5XX", "*"):
590
534
  http_res_text = await utils.stream_to_text_async(http_res)
591
- raise models.APIError(
592
- "API error occurred", http_res.status_code, http_res_text, http_res
593
- )
535
+ raise models.APIError("API error occurred", http_res, http_res_text)
594
536
 
595
- content_type = http_res.headers.get("Content-Type")
596
- http_res_text = await utils.stream_to_text_async(http_res)
597
- raise models.APIError(
598
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
599
- http_res.status_code,
600
- http_res_text,
601
- http_res,
602
- )
537
+ raise models.APIError("Unexpected response received", http_res)
603
538
 
604
539
  def update_filesystem(
605
540
  self,
@@ -691,28 +626,17 @@ class Storage(BaseSDK):
691
626
  )
692
627
 
693
628
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
694
- return utils.unmarshal_json(
695
- http_res.text, models.PatchStorageFilesystemsResponseBody
629
+ return unmarshal_json_response(
630
+ models.PatchStorageFilesystemsResponseBody, http_res
696
631
  )
697
632
  if utils.match_response(http_res, ["403", "422", "4XX"], "*"):
698
633
  http_res_text = utils.stream_to_text(http_res)
699
- raise models.APIError(
700
- "API error occurred", http_res.status_code, http_res_text, http_res
701
- )
634
+ raise models.APIError("API error occurred", http_res, http_res_text)
702
635
  if utils.match_response(http_res, "5XX", "*"):
703
636
  http_res_text = utils.stream_to_text(http_res)
704
- raise models.APIError(
705
- "API error occurred", http_res.status_code, http_res_text, http_res
706
- )
637
+ raise models.APIError("API error occurred", http_res, http_res_text)
707
638
 
708
- content_type = http_res.headers.get("Content-Type")
709
- http_res_text = utils.stream_to_text(http_res)
710
- raise models.APIError(
711
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
712
- http_res.status_code,
713
- http_res_text,
714
- http_res,
715
- )
639
+ raise models.APIError("Unexpected response received", http_res)
716
640
 
717
641
  async def update_filesystem_async(
718
642
  self,
@@ -804,25 +728,14 @@ class Storage(BaseSDK):
804
728
  )
805
729
 
806
730
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
807
- return utils.unmarshal_json(
808
- http_res.text, models.PatchStorageFilesystemsResponseBody
731
+ return unmarshal_json_response(
732
+ models.PatchStorageFilesystemsResponseBody, http_res
809
733
  )
810
734
  if utils.match_response(http_res, ["403", "422", "4XX"], "*"):
811
735
  http_res_text = await utils.stream_to_text_async(http_res)
812
- raise models.APIError(
813
- "API error occurred", http_res.status_code, http_res_text, http_res
814
- )
736
+ raise models.APIError("API error occurred", http_res, http_res_text)
815
737
  if utils.match_response(http_res, "5XX", "*"):
816
738
  http_res_text = await utils.stream_to_text_async(http_res)
817
- raise models.APIError(
818
- "API error occurred", http_res.status_code, http_res_text, http_res
819
- )
739
+ raise models.APIError("API error occurred", http_res, http_res_text)
820
740
 
821
- content_type = http_res.headers.get("Content-Type")
822
- http_res_text = await utils.stream_to_text_async(http_res)
823
- raise models.APIError(
824
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
825
- http_res.status_code,
826
- http_res_text,
827
- http_res,
828
- )
741
+ raise models.APIError("Unexpected response received", http_res)
@@ -5,6 +5,7 @@ from latitudesh_python_sdk import models, utils
5
5
  from latitudesh_python_sdk._hooks import HookContext
6
6
  from latitudesh_python_sdk.types import OptionalNullable, UNSET
7
7
  from latitudesh_python_sdk.utils import get_security_from_env
8
+ from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
8
9
  from typing import Mapping, Optional, Union
9
10
 
10
11
 
@@ -76,26 +77,15 @@ class Tags(BaseSDK):
76
77
  )
77
78
 
78
79
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
79
- return utils.unmarshal_json(http_res.text, models.CustomTags)
80
+ return unmarshal_json_response(models.CustomTags, http_res)
80
81
  if utils.match_response(http_res, "4XX", "*"):
81
82
  http_res_text = utils.stream_to_text(http_res)
82
- raise models.APIError(
83
- "API error occurred", http_res.status_code, http_res_text, http_res
84
- )
83
+ raise models.APIError("API error occurred", http_res, http_res_text)
85
84
  if utils.match_response(http_res, "5XX", "*"):
86
85
  http_res_text = utils.stream_to_text(http_res)
87
- raise models.APIError(
88
- "API error occurred", http_res.status_code, http_res_text, http_res
89
- )
90
-
91
- content_type = http_res.headers.get("Content-Type")
92
- http_res_text = utils.stream_to_text(http_res)
93
- raise models.APIError(
94
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
95
- http_res.status_code,
96
- http_res_text,
97
- http_res,
98
- )
86
+ raise models.APIError("API error occurred", http_res, http_res_text)
87
+
88
+ raise models.APIError("Unexpected response received", http_res)
99
89
 
100
90
  async def list_async(
101
91
  self,
@@ -164,26 +154,15 @@ class Tags(BaseSDK):
164
154
  )
165
155
 
166
156
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
167
- return utils.unmarshal_json(http_res.text, models.CustomTags)
157
+ return unmarshal_json_response(models.CustomTags, http_res)
168
158
  if utils.match_response(http_res, "4XX", "*"):
169
159
  http_res_text = await utils.stream_to_text_async(http_res)
170
- raise models.APIError(
171
- "API error occurred", http_res.status_code, http_res_text, http_res
172
- )
160
+ raise models.APIError("API error occurred", http_res, http_res_text)
173
161
  if utils.match_response(http_res, "5XX", "*"):
174
162
  http_res_text = await utils.stream_to_text_async(http_res)
175
- raise models.APIError(
176
- "API error occurred", http_res.status_code, http_res_text, http_res
177
- )
178
-
179
- content_type = http_res.headers.get("Content-Type")
180
- http_res_text = await utils.stream_to_text_async(http_res)
181
- raise models.APIError(
182
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
183
- http_res.status_code,
184
- http_res_text,
185
- http_res,
186
- )
163
+ raise models.APIError("API error occurred", http_res, http_res_text)
164
+
165
+ raise models.APIError("Unexpected response received", http_res)
187
166
 
188
167
  def create(
189
168
  self,
@@ -264,26 +243,15 @@ class Tags(BaseSDK):
264
243
  )
265
244
 
266
245
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
267
- return utils.unmarshal_json(http_res.text, models.CustomTag)
246
+ return unmarshal_json_response(models.CustomTag, http_res)
268
247
  if utils.match_response(http_res, ["422", "4XX"], "*"):
269
248
  http_res_text = utils.stream_to_text(http_res)
270
- raise models.APIError(
271
- "API error occurred", http_res.status_code, http_res_text, http_res
272
- )
249
+ raise models.APIError("API error occurred", http_res, http_res_text)
273
250
  if utils.match_response(http_res, "5XX", "*"):
274
251
  http_res_text = utils.stream_to_text(http_res)
275
- raise models.APIError(
276
- "API error occurred", http_res.status_code, http_res_text, http_res
277
- )
278
-
279
- content_type = http_res.headers.get("Content-Type")
280
- http_res_text = utils.stream_to_text(http_res)
281
- raise models.APIError(
282
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
283
- http_res.status_code,
284
- http_res_text,
285
- http_res,
286
- )
252
+ raise models.APIError("API error occurred", http_res, http_res_text)
253
+
254
+ raise models.APIError("Unexpected response received", http_res)
287
255
 
288
256
  async def create_async(
289
257
  self,
@@ -364,26 +332,15 @@ class Tags(BaseSDK):
364
332
  )
365
333
 
366
334
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
367
- return utils.unmarshal_json(http_res.text, models.CustomTag)
335
+ return unmarshal_json_response(models.CustomTag, http_res)
368
336
  if utils.match_response(http_res, ["422", "4XX"], "*"):
369
337
  http_res_text = await utils.stream_to_text_async(http_res)
370
- raise models.APIError(
371
- "API error occurred", http_res.status_code, http_res_text, http_res
372
- )
338
+ raise models.APIError("API error occurred", http_res, http_res_text)
373
339
  if utils.match_response(http_res, "5XX", "*"):
374
340
  http_res_text = await utils.stream_to_text_async(http_res)
375
- raise models.APIError(
376
- "API error occurred", http_res.status_code, http_res_text, http_res
377
- )
378
-
379
- content_type = http_res.headers.get("Content-Type")
380
- http_res_text = await utils.stream_to_text_async(http_res)
381
- raise models.APIError(
382
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
383
- http_res.status_code,
384
- http_res_text,
385
- http_res,
386
- )
341
+ raise models.APIError("API error occurred", http_res, http_res_text)
342
+
343
+ raise models.APIError("Unexpected response received", http_res)
387
344
 
388
345
  def update(
389
346
  self,
@@ -473,26 +430,15 @@ class Tags(BaseSDK):
473
430
  )
474
431
 
475
432
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
476
- return utils.unmarshal_json(http_res.text, models.CustomTag)
433
+ return unmarshal_json_response(models.CustomTag, http_res)
477
434
  if utils.match_response(http_res, ["404", "422", "4XX"], "*"):
478
435
  http_res_text = utils.stream_to_text(http_res)
479
- raise models.APIError(
480
- "API error occurred", http_res.status_code, http_res_text, http_res
481
- )
436
+ raise models.APIError("API error occurred", http_res, http_res_text)
482
437
  if utils.match_response(http_res, "5XX", "*"):
483
438
  http_res_text = utils.stream_to_text(http_res)
484
- raise models.APIError(
485
- "API error occurred", http_res.status_code, http_res_text, http_res
486
- )
487
-
488
- content_type = http_res.headers.get("Content-Type")
489
- http_res_text = utils.stream_to_text(http_res)
490
- raise models.APIError(
491
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
492
- http_res.status_code,
493
- http_res_text,
494
- http_res,
495
- )
439
+ raise models.APIError("API error occurred", http_res, http_res_text)
440
+
441
+ raise models.APIError("Unexpected response received", http_res)
496
442
 
497
443
  async def update_async(
498
444
  self,
@@ -582,26 +528,15 @@ class Tags(BaseSDK):
582
528
  )
583
529
 
584
530
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
585
- return utils.unmarshal_json(http_res.text, models.CustomTag)
531
+ return unmarshal_json_response(models.CustomTag, http_res)
586
532
  if utils.match_response(http_res, ["404", "422", "4XX"], "*"):
587
533
  http_res_text = await utils.stream_to_text_async(http_res)
588
- raise models.APIError(
589
- "API error occurred", http_res.status_code, http_res_text, http_res
590
- )
534
+ raise models.APIError("API error occurred", http_res, http_res_text)
591
535
  if utils.match_response(http_res, "5XX", "*"):
592
536
  http_res_text = await utils.stream_to_text_async(http_res)
593
- raise models.APIError(
594
- "API error occurred", http_res.status_code, http_res_text, http_res
595
- )
596
-
597
- content_type = http_res.headers.get("Content-Type")
598
- http_res_text = await utils.stream_to_text_async(http_res)
599
- raise models.APIError(
600
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
601
- http_res.status_code,
602
- http_res_text,
603
- http_res,
604
- )
537
+ raise models.APIError("API error occurred", http_res, http_res_text)
538
+
539
+ raise models.APIError("Unexpected response received", http_res)
605
540
 
606
541
  def delete(
607
542
  self,
@@ -680,23 +615,12 @@ class Tags(BaseSDK):
680
615
  return
681
616
  if utils.match_response(http_res, ["404", "4XX"], "*"):
682
617
  http_res_text = utils.stream_to_text(http_res)
683
- raise models.APIError(
684
- "API error occurred", http_res.status_code, http_res_text, http_res
685
- )
618
+ raise models.APIError("API error occurred", http_res, http_res_text)
686
619
  if utils.match_response(http_res, "5XX", "*"):
687
620
  http_res_text = utils.stream_to_text(http_res)
688
- raise models.APIError(
689
- "API error occurred", http_res.status_code, http_res_text, http_res
690
- )
691
-
692
- content_type = http_res.headers.get("Content-Type")
693
- http_res_text = utils.stream_to_text(http_res)
694
- raise models.APIError(
695
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
696
- http_res.status_code,
697
- http_res_text,
698
- http_res,
699
- )
621
+ raise models.APIError("API error occurred", http_res, http_res_text)
622
+
623
+ raise models.APIError("Unexpected response received", http_res)
700
624
 
701
625
  async def delete_async(
702
626
  self,
@@ -775,20 +699,9 @@ class Tags(BaseSDK):
775
699
  return
776
700
  if utils.match_response(http_res, ["404", "4XX"], "*"):
777
701
  http_res_text = await utils.stream_to_text_async(http_res)
778
- raise models.APIError(
779
- "API error occurred", http_res.status_code, http_res_text, http_res
780
- )
702
+ raise models.APIError("API error occurred", http_res, http_res_text)
781
703
  if utils.match_response(http_res, "5XX", "*"):
782
704
  http_res_text = await utils.stream_to_text_async(http_res)
783
- raise models.APIError(
784
- "API error occurred", http_res.status_code, http_res_text, http_res
785
- )
786
-
787
- content_type = http_res.headers.get("Content-Type")
788
- http_res_text = await utils.stream_to_text_async(http_res)
789
- raise models.APIError(
790
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
791
- http_res.status_code,
792
- http_res_text,
793
- http_res,
794
- )
705
+ raise models.APIError("API error occurred", http_res, http_res_text)
706
+
707
+ raise models.APIError("Unexpected response received", http_res)