platform-api-python-client 4.31.0__py3-none-any.whl → 4.41.0__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.
- platform_api_python_client/__init__.py +410 -148
- platform_api_python_client/api/external_api.py +6466 -1215
- platform_api_python_client/api_client.py +81 -36
- platform_api_python_client/configuration.py +262 -66
- platform_api_python_client/exceptions.py +24 -5
- platform_api_python_client/models/__init__.py +90 -35
- platform_api_python_client/models/admission.py +106 -0
- platform_api_python_client/models/autoscaling.py +120 -0
- platform_api_python_client/models/ccl_dynamo_pools.py +117 -0
- platform_api_python_client/models/{create_c_serve_v2_deployment_response.py → ccl_main_pools.py} +16 -16
- platform_api_python_client/models/ccluster_catalogs_cluster_base_argo_rollouts_chart_values.py +121 -0
- platform_api_python_client/models/{c_serve_v2_recipe.py → ccluster_catalogs_cluster_base_argo_rollouts_controller.py} +15 -18
- platform_api_python_client/models/ccluster_catalogs_cluster_base_argo_rollouts_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_cert_manager_chart_values.py +117 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_cert_manager_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_gpu_operator_chart_values.py +152 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_gpu_operator_values.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_chart_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_controller.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_istio_values.py +143 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_kai_scheduler_chart_values.py +154 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_kai_scheduler_values.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_keda_chart_values.py +131 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_keda_values.py +110 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_kube_prometheus_stack_chart_values.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_kube_prometheus_stack_values.py +121 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_metrics_server_chart_values.py +106 -0
- platform_api_python_client/models/ccluster_catalogs_cluster_base_metrics_server_values.py +110 -0
- platform_api_python_client/models/cdi.py +113 -0
- platform_api_python_client/models/cluster_base_components.py +187 -0
- platform_api_python_client/models/cluster_capacity_response.py +5 -5
- platform_api_python_client/models/cluster_credential.py +6 -5
- platform_api_python_client/models/cluster_registration_request.py +4 -3
- platform_api_python_client/models/cluster_registration_response.py +4 -3
- platform_api_python_client/models/{istio_cni_overrides.py → cni.py} +29 -15
- platform_api_python_client/models/config_file_mount.py +6 -5
- platform_api_python_client/models/create_compute_deployment_request.py +35 -9
- platform_api_python_client/models/create_compute_deployment_response.py +4 -3
- platform_api_python_client/models/create_dynamo_deployment_request.py +67 -20
- platform_api_python_client/models/create_dynamo_deployment_response.py +4 -3
- platform_api_python_client/models/create_filesystem_volume_request.py +8 -20
- platform_api_python_client/models/create_hardware_instance_request.py +4 -3
- platform_api_python_client/models/create_inference_deployment_response.py +4 -3
- platform_api_python_client/models/create_inference_v3_deployment_request.py +52 -10
- platform_api_python_client/models/create_job_deployment_request.py +35 -9
- platform_api_python_client/models/create_job_deployment_response.py +4 -3
- platform_api_python_client/models/create_object_volume_request.py +10 -22
- platform_api_python_client/models/create_organization_request.py +4 -3
- platform_api_python_client/models/create_organization_response.py +4 -3
- platform_api_python_client/models/create_service_account_request.py +4 -3
- platform_api_python_client/models/create_service_account_response.py +4 -3
- platform_api_python_client/models/credits_response.py +4 -3
- platform_api_python_client/models/daily_bill_response.py +4 -3
- platform_api_python_client/models/{fluent_bit.py → dashboard.py} +29 -12
- platform_api_python_client/models/{prometheus_adapter.py → default_priorities.py} +29 -12
- platform_api_python_client/models/default_queue.py +106 -0
- platform_api_python_client/models/delete_user_vault_item_request.py +4 -3
- platform_api_python_client/models/deployment_log_event_v4.py +4 -3
- platform_api_python_client/models/deployment_response.py +12 -27
- platform_api_python_client/models/deployment_status_request.py +4 -3
- platform_api_python_client/models/deployment_status_response.py +4 -3
- platform_api_python_client/models/deployment_status_v3_response.py +5 -5
- platform_api_python_client/models/deployment_type.py +14 -0
- platform_api_python_client/models/deployment_usage.py +5 -5
- platform_api_python_client/models/deployment_usage_value.py +4 -3
- platform_api_python_client/models/dynamo_communications_input.py +4 -16
- platform_api_python_client/models/dynamo_frontend_config.py +105 -0
- platform_api_python_client/models/dynamo_frontend_config_response.py +105 -0
- platform_api_python_client/models/dynamo_image.py +106 -0
- platform_api_python_client/models/dynamo_kv_transfer_configuration.py +4 -16
- platform_api_python_client/models/{external_dns.py → dynamo_weight_transfer_configuration.py} +13 -13
- platform_api_python_client/models/dynamo_weight_transfer_policy.py +36 -0
- platform_api_python_client/models/dynamo_worker_pool_config.py +6 -18
- platform_api_python_client/models/dynamo_worker_pools.py +4 -16
- platform_api_python_client/models/{keda.py → env.py} +14 -13
- platform_api_python_client/models/generate_service_account_secret_response.py +4 -3
- platform_api_python_client/models/get_cluster_response.py +8 -5
- platform_api_python_client/models/get_compute_deployment_response.py +35 -8
- platform_api_python_client/models/get_deployment_log_response.py +4 -3
- platform_api_python_client/models/get_deployment_log_v4_response.py +5 -5
- platform_api_python_client/models/get_deployment_pods_response.py +4 -3
- platform_api_python_client/models/get_deployment_response.py +7 -7
- platform_api_python_client/models/get_deployment_revision_response.py +4 -3
- platform_api_python_client/models/get_deployment_usage_response.py +24 -9
- platform_api_python_client/models/get_dynamo_deployment_response.py +63 -15
- platform_api_python_client/models/get_filesystem_volume_response.py +4 -3
- platform_api_python_client/models/get_inference_deployment_response.py +7 -7
- platform_api_python_client/models/get_inference_v3_deployment_response.py +51 -8
- platform_api_python_client/models/get_job_deployment_response.py +35 -8
- platform_api_python_client/models/get_object_volume_response.py +4 -3
- platform_api_python_client/models/gpu_type_capacity.py +4 -3
- platform_api_python_client/models/hardware_instance_response.py +10 -5
- platform_api_python_client/models/hardware_preset_response.py +4 -3
- platform_api_python_client/models/http_validation_error.py +5 -5
- platform_api_python_client/models/image.py +113 -0
- platform_api_python_client/models/image_pull_secret_credentials.py +4 -3
- platform_api_python_client/models/{istio_cni_subchart_overrides.py → ingress.py} +26 -18
- platform_api_python_client/models/{c_serve_recipe_response.py → insight_list_item_response.py} +33 -27
- platform_api_python_client/models/{create_c_serve_v3_deployment_response.py → insight_resource.py} +20 -14
- platform_api_python_client/models/insight_resource_type.py +37 -0
- platform_api_python_client/models/insight_response.py +133 -0
- platform_api_python_client/models/insight_severity.py +40 -0
- platform_api_python_client/models/insight_status.py +39 -0
- platform_api_python_client/models/insight_status_change_response.py +108 -0
- platform_api_python_client/models/invite_user_request.py +4 -3
- platform_api_python_client/models/istio_base.py +106 -0
- platform_api_python_client/models/istio_cni.py +124 -0
- platform_api_python_client/models/{ingress_nginx.py → istio_gateway.py} +29 -12
- platform_api_python_client/models/{dynamo_communications_output.py → istiod.py} +21 -15
- platform_api_python_client/models/list_cluster_capacity_response.py +5 -5
- platform_api_python_client/models/list_daily_bill_response.py +5 -5
- platform_api_python_client/models/list_deployment_revisions_response.py +5 -5
- platform_api_python_client/models/list_get_cluster_response.py +5 -5
- platform_api_python_client/models/list_get_deployment_response.py +5 -5
- platform_api_python_client/models/list_hardware_instance_response.py +5 -5
- platform_api_python_client/models/list_hardware_preset_response.py +5 -5
- platform_api_python_client/models/{istio_overrides.py → list_insights_response.py} +19 -20
- platform_api_python_client/models/list_organization_gpu_quota_response.py +5 -5
- platform_api_python_client/models/list_prebuilt_image_response.py +5 -5
- platform_api_python_client/models/list_service_accounts_response.py +5 -5
- platform_api_python_client/models/list_user_vault_items_response.py +5 -5
- platform_api_python_client/models/list_volumes_response.py +5 -5
- platform_api_python_client/models/{validation_error_loc_inner.py → location_inner.py} +6 -6
- platform_api_python_client/models/metric.py +13 -0
- platform_api_python_client/models/metrics.py +117 -0
- platform_api_python_client/models/metrics_config.py +6 -5
- platform_api_python_client/models/mig.py +106 -0
- platform_api_python_client/models/operator.py +117 -0
- platform_api_python_client/models/organization_gpu_quota_request.py +4 -3
- platform_api_python_client/models/organization_gpu_quota_response.py +4 -3
- platform_api_python_client/models/pilot.py +106 -0
- platform_api_python_client/models/pod_details.py +4 -3
- platform_api_python_client/models/pool.py +117 -0
- platform_api_python_client/models/prebuilt_image_response.py +4 -3
- platform_api_python_client/models/prometheus.py +110 -0
- platform_api_python_client/models/prometheus_rules.py +120 -0
- platform_api_python_client/models/prometheus_spec.py +113 -0
- platform_api_python_client/models/prometheus_values.py +117 -0
- platform_api_python_client/models/quota.py +106 -0
- platform_api_python_client/models/replicas.py +106 -0
- platform_api_python_client/models/resource_list.py +113 -0
- platform_api_python_client/models/resource_requirements.py +120 -0
- platform_api_python_client/models/revision_pod_details.py +5 -5
- platform_api_python_client/models/rollout_strategy_params.py +4 -3
- platform_api_python_client/models/scheduler.py +117 -0
- platform_api_python_client/models/service_account_response.py +4 -3
- platform_api_python_client/models/{istio.py → toggle.py} +27 -19
- platform_api_python_client/models/toleration.py +134 -0
- platform_api_python_client/models/unified_get_compute_deployment_response.py +177 -0
- platform_api_python_client/models/{c_serve_recipe_perf.py → unified_get_deployment_logs_response.py} +19 -22
- platform_api_python_client/models/{longhorn.py → unified_get_deployment_pods_response.py} +13 -14
- platform_api_python_client/models/unified_get_deployment_response.py +164 -0
- platform_api_python_client/models/unified_get_deployment_revision_response.py +110 -0
- platform_api_python_client/models/{argo_rollouts.py → unified_get_deployment_rollout_response.py} +15 -13
- platform_api_python_client/models/unified_get_deployment_usage_response.py +110 -0
- platform_api_python_client/models/unified_get_dynamo_deployment_response.py +218 -0
- platform_api_python_client/models/unified_get_inference_v3_deployment_response.py +228 -0
- platform_api_python_client/models/unified_get_job_deployment_response.py +204 -0
- platform_api_python_client/models/{list_c_serve_recipe_response.py → unified_list_deployment_revisions_response.py} +12 -12
- platform_api_python_client/models/{spire.py → unified_update_deployment_rollout_request.py} +12 -13
- platform_api_python_client/models/unified_write_compute_deployment_request.py +154 -0
- platform_api_python_client/models/unified_write_deployment_request.py +164 -0
- platform_api_python_client/models/unified_write_deployment_response.py +110 -0
- platform_api_python_client/models/unified_write_dynamo_deployment_request.py +197 -0
- platform_api_python_client/models/{create_c_serve_v3_deployment_request.py → unified_write_inference_v3_deployment_request.py} +86 -78
- platform_api_python_client/models/unified_write_job_deployment_request.py +183 -0
- platform_api_python_client/models/update_cluster_metadata_request.py +4 -3
- platform_api_python_client/models/{cluster_config.py → update_cluster_request.py} +11 -10
- platform_api_python_client/models/update_deployment_response.py +4 -3
- platform_api_python_client/models/update_deployment_status_v3_request.py +4 -3
- platform_api_python_client/models/update_insight_status_request.py +107 -0
- platform_api_python_client/models/update_service_account_request.py +4 -3
- platform_api_python_client/models/upsert_user_vault_item_request.py +5 -4
- platform_api_python_client/models/usage_availability.py +40 -0
- platform_api_python_client/models/usage_component.py +39 -0
- platform_api_python_client/models/user_vault_item.py +4 -3
- platform_api_python_client/models/validation_error.py +8 -8
- platform_api_python_client/models/volume_mount.py +4 -3
- platform_api_python_client/models/volume_status_response.py +4 -3
- platform_api_python_client/models/workload.py +110 -0
- platform_api_python_client/rest.py +87 -10
- platform_api_python_client-4.41.0.dist-info/METADATA +418 -0
- platform_api_python_client-4.41.0.dist-info/RECORD +206 -0
- {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.41.0.dist-info}/WHEEL +1 -1
- platform_api_python_client/models/cert_manager.py +0 -89
- platform_api_python_client/models/cluster_components.py +0 -193
- platform_api_python_client/models/final_stack.py +0 -89
- platform_api_python_client/models/get_c_serve_v2_deployment_response.py +0 -193
- platform_api_python_client/models/get_c_serve_v3_deployment_response.py +0 -194
- platform_api_python_client/models/gpu_operator.py +0 -89
- platform_api_python_client/models/kube_prometheus_stack.py +0 -89
- platform_api_python_client/models/metrics_server.py +0 -89
- platform_api_python_client/models/network_operator.py +0 -89
- platform_api_python_client/models/opentelemetry_collector.py +0 -89
- platform_api_python_client/models/spire_crds.py +0 -89
- platform_api_python_client/models/teleport_kube_agent.py +0 -89
- platform_api_python_client-4.31.0.dist-info/METADATA +0 -23
- platform_api_python_client-4.31.0.dist-info/RECORD +0 -151
- {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.41.0.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
1
|
"""
|
|
4
2
|
Platform External API
|
|
5
3
|
|
|
@@ -12,6 +10,7 @@
|
|
|
12
10
|
""" # noqa: E501
|
|
13
11
|
|
|
14
12
|
|
|
13
|
+
|
|
15
14
|
import datetime
|
|
16
15
|
from dateutil.parser import parse
|
|
17
16
|
from enum import Enum
|
|
@@ -21,6 +20,7 @@ import mimetypes
|
|
|
21
20
|
import os
|
|
22
21
|
import re
|
|
23
22
|
import tempfile
|
|
23
|
+
import uuid
|
|
24
24
|
|
|
25
25
|
from urllib.parse import quote
|
|
26
26
|
from typing import Tuple, Optional, List, Dict, Union
|
|
@@ -68,6 +68,7 @@ class ApiClient:
|
|
|
68
68
|
'date': datetime.date,
|
|
69
69
|
'datetime': datetime.datetime,
|
|
70
70
|
'decimal': decimal.Decimal,
|
|
71
|
+
'UUID': uuid.UUID,
|
|
71
72
|
'object': object,
|
|
72
73
|
}
|
|
73
74
|
_pool = None
|
|
@@ -90,7 +91,7 @@ class ApiClient:
|
|
|
90
91
|
self.default_headers[header_name] = header_value
|
|
91
92
|
self.cookie = cookie
|
|
92
93
|
# Set default User-Agent.
|
|
93
|
-
self.user_agent = 'OpenAPI-Generator/4.
|
|
94
|
+
self.user_agent = 'OpenAPI-Generator/4.41.0/python'
|
|
94
95
|
self.client_side_validation = configuration.client_side_validation
|
|
95
96
|
|
|
96
97
|
def __enter__(self):
|
|
@@ -246,7 +247,6 @@ class ApiClient:
|
|
|
246
247
|
|
|
247
248
|
return method, url, header_params, body, post_params
|
|
248
249
|
|
|
249
|
-
|
|
250
250
|
def call_api(
|
|
251
251
|
self,
|
|
252
252
|
method,
|
|
@@ -301,17 +301,23 @@ class ApiClient:
|
|
|
301
301
|
# if not found, look for '1XX', '2XX', etc.
|
|
302
302
|
response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)
|
|
303
303
|
|
|
304
|
+
# If the response_type has not matched (eg. did not match the previous if statements) and the default response is available, use it.
|
|
305
|
+
if response_type is None and str(response_data.status) not in response_types_map \
|
|
306
|
+
and (not isinstance(response_data.status, int) or not 100 <= response_data.status <= 599 or str(response_data.status)[0] + "XX" not in response_types_map) \
|
|
307
|
+
and 'default' in response_types_map:
|
|
308
|
+
response_type = response_types_map['default']
|
|
309
|
+
|
|
304
310
|
# deserialize response data
|
|
305
311
|
response_text = None
|
|
306
312
|
return_data = None
|
|
307
313
|
try:
|
|
308
|
-
if response_type
|
|
314
|
+
if response_type in ("bytearray", "bytes"):
|
|
309
315
|
return_data = response_data.data
|
|
310
316
|
elif response_type == "file":
|
|
311
317
|
return_data = self.__deserialize_file(response_data)
|
|
312
318
|
elif response_type is not None:
|
|
313
319
|
match = None
|
|
314
|
-
content_type = response_data.
|
|
320
|
+
content_type = response_data.headers.get('content-type')
|
|
315
321
|
if content_type is not None:
|
|
316
322
|
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
|
|
317
323
|
encoding = match.group(1) if match else "utf-8"
|
|
@@ -328,7 +334,7 @@ class ApiClient:
|
|
|
328
334
|
return ApiResponse(
|
|
329
335
|
status_code = response_data.status,
|
|
330
336
|
data = return_data,
|
|
331
|
-
headers = response_data.
|
|
337
|
+
headers = response_data.headers,
|
|
332
338
|
raw_data = response_data.data
|
|
333
339
|
)
|
|
334
340
|
|
|
@@ -356,6 +362,8 @@ class ApiClient:
|
|
|
356
362
|
return obj.get_secret_value()
|
|
357
363
|
elif isinstance(obj, self.PRIMITIVE_TYPES):
|
|
358
364
|
return obj
|
|
365
|
+
elif isinstance(obj, uuid.UUID):
|
|
366
|
+
return str(obj)
|
|
359
367
|
elif isinstance(obj, list):
|
|
360
368
|
return [
|
|
361
369
|
self.sanitize_for_serialization(sub_obj) for sub_obj in obj
|
|
@@ -368,24 +376,24 @@ class ApiClient:
|
|
|
368
376
|
return obj.isoformat()
|
|
369
377
|
elif isinstance(obj, decimal.Decimal):
|
|
370
378
|
return str(obj)
|
|
371
|
-
|
|
372
379
|
elif isinstance(obj, dict):
|
|
373
|
-
|
|
380
|
+
return {
|
|
381
|
+
key: self.sanitize_for_serialization(val)
|
|
382
|
+
for key, val in obj.items()
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
# Convert model obj to dict except
|
|
386
|
+
# attributes `openapi_types`, `attribute_map`
|
|
387
|
+
# and attributes which value is not None.
|
|
388
|
+
# Convert attribute name to json key in
|
|
389
|
+
# model definition for request.
|
|
390
|
+
if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
|
|
391
|
+
obj_dict = obj.to_dict()
|
|
374
392
|
else:
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
# Convert attribute name to json key in
|
|
379
|
-
# model definition for request.
|
|
380
|
-
if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
|
|
381
|
-
obj_dict = obj.to_dict()
|
|
382
|
-
else:
|
|
383
|
-
obj_dict = obj.__dict__
|
|
393
|
+
obj_dict = obj.__dict__
|
|
394
|
+
|
|
395
|
+
return self.sanitize_for_serialization(obj_dict)
|
|
384
396
|
|
|
385
|
-
return {
|
|
386
|
-
key: self.sanitize_for_serialization(val)
|
|
387
|
-
for key, val in obj_dict.items()
|
|
388
|
-
}
|
|
389
397
|
|
|
390
398
|
def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
|
|
391
399
|
"""Deserializes response into an object.
|
|
@@ -404,7 +412,7 @@ class ApiClient:
|
|
|
404
412
|
data = json.loads(response_text)
|
|
405
413
|
except ValueError:
|
|
406
414
|
data = response_text
|
|
407
|
-
elif re.match(r'^application/(json|[\w
|
|
415
|
+
elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
|
|
408
416
|
if response_text == "":
|
|
409
417
|
data = ""
|
|
410
418
|
else:
|
|
@@ -431,6 +439,12 @@ class ApiClient:
|
|
|
431
439
|
return None
|
|
432
440
|
|
|
433
441
|
if isinstance(klass, str):
|
|
442
|
+
if klass.startswith('Optional['):
|
|
443
|
+
m = re.match(r'Optional\[(.*)]', klass)
|
|
444
|
+
assert m is not None, "Malformed Optional type definition"
|
|
445
|
+
# data is not None here, so the optionality is already resolved
|
|
446
|
+
return self.__deserialize(data, m.group(1))
|
|
447
|
+
|
|
434
448
|
if klass.startswith('List['):
|
|
435
449
|
m = re.match(r'List\[(.*)]', klass)
|
|
436
450
|
assert m is not None, "Malformed List type definition"
|
|
@@ -453,14 +467,16 @@ class ApiClient:
|
|
|
453
467
|
|
|
454
468
|
if klass in self.PRIMITIVE_TYPES:
|
|
455
469
|
return self.__deserialize_primitive(data, klass)
|
|
456
|
-
elif klass
|
|
470
|
+
elif klass is object:
|
|
457
471
|
return self.__deserialize_object(data)
|
|
458
|
-
elif klass
|
|
472
|
+
elif klass is datetime.date:
|
|
459
473
|
return self.__deserialize_date(data)
|
|
460
|
-
elif klass
|
|
474
|
+
elif klass is datetime.datetime:
|
|
461
475
|
return self.__deserialize_datetime(data)
|
|
462
|
-
elif klass
|
|
476
|
+
elif klass is decimal.Decimal:
|
|
463
477
|
return decimal.Decimal(data)
|
|
478
|
+
elif klass is uuid.UUID:
|
|
479
|
+
return uuid.UUID(data)
|
|
464
480
|
elif issubclass(klass, Enum):
|
|
465
481
|
return self.__deserialize_enum(data, klass)
|
|
466
482
|
else:
|
|
@@ -477,10 +493,15 @@ class ApiClient:
|
|
|
477
493
|
if collection_formats is None:
|
|
478
494
|
collection_formats = {}
|
|
479
495
|
for k, v in params.items() if isinstance(params, dict) else params:
|
|
496
|
+
if isinstance(v, bool):
|
|
497
|
+
v = str(v).lower()
|
|
480
498
|
if k in collection_formats:
|
|
481
499
|
collection_format = collection_formats[k]
|
|
482
500
|
if collection_format == 'multi':
|
|
483
|
-
new_params.extend(
|
|
501
|
+
new_params.extend(
|
|
502
|
+
(k, str(value).lower() if isinstance(value, bool) else value)
|
|
503
|
+
for value in v
|
|
504
|
+
)
|
|
484
505
|
else:
|
|
485
506
|
if collection_format == 'ssv':
|
|
486
507
|
delimiter = ' '
|
|
@@ -491,11 +512,20 @@ class ApiClient:
|
|
|
491
512
|
else: # csv is the default
|
|
492
513
|
delimiter = ','
|
|
493
514
|
new_params.append(
|
|
494
|
-
(k, delimiter.join(
|
|
515
|
+
(k, delimiter.join(
|
|
516
|
+
str(value).lower() if isinstance(value, bool) else str(value)
|
|
517
|
+
for value in v)))
|
|
495
518
|
else:
|
|
496
519
|
new_params.append((k, v))
|
|
497
520
|
return new_params
|
|
498
521
|
|
|
522
|
+
def explode_query_object(self, name, obj):
|
|
523
|
+
"""form style, explode: one query parameter per entry, keyed by the property name; a list repeats the name, None is left out"""
|
|
524
|
+
obj = self.sanitize_for_serialization(obj)
|
|
525
|
+
if not isinstance(obj, dict):
|
|
526
|
+
obj = {name: obj}
|
|
527
|
+
return [(k, item) for k, v in obj.items() for item in (v if isinstance(v, (list, tuple)) else [v]) if item is not None]
|
|
528
|
+
|
|
499
529
|
def parameters_to_url_query(self, params, collection_formats):
|
|
500
530
|
"""Get parameters as list of tuples, formatting collections.
|
|
501
531
|
|
|
@@ -514,10 +544,14 @@ class ApiClient:
|
|
|
514
544
|
if isinstance(v, dict):
|
|
515
545
|
v = json.dumps(v)
|
|
516
546
|
|
|
517
|
-
|
|
547
|
+
# a collection format applies only to a list; an exploded entry may share a declared array parameter's name
|
|
548
|
+
if k in collection_formats and isinstance(v, (list, tuple)):
|
|
518
549
|
collection_format = collection_formats[k]
|
|
519
550
|
if collection_format == 'multi':
|
|
520
|
-
new_params.extend(
|
|
551
|
+
new_params.extend(
|
|
552
|
+
(quote(str(k)), quote(str(value).lower() if isinstance(value, bool) else str(value)))
|
|
553
|
+
for value in v
|
|
554
|
+
)
|
|
521
555
|
else:
|
|
522
556
|
if collection_format == 'ssv':
|
|
523
557
|
delimiter = ' '
|
|
@@ -528,10 +562,13 @@ class ApiClient:
|
|
|
528
562
|
else: # csv is the default
|
|
529
563
|
delimiter = ','
|
|
530
564
|
new_params.append(
|
|
531
|
-
(k, delimiter.join(
|
|
565
|
+
(quote(str(k)), delimiter.join(
|
|
566
|
+
quote(str(value).lower() if isinstance(value, bool) else str(value))
|
|
567
|
+
for value in v))
|
|
532
568
|
)
|
|
533
569
|
else:
|
|
534
|
-
|
|
570
|
+
# names are quoted too: an exploded object's names are runtime data
|
|
571
|
+
new_params.append((quote(str(k)), quote(str(v))))
|
|
535
572
|
|
|
536
573
|
return "&".join(["=".join(map(str, item)) for item in new_params])
|
|
537
574
|
|
|
@@ -667,7 +704,13 @@ class ApiClient:
|
|
|
667
704
|
:param auth_setting: auth settings for the endpoint
|
|
668
705
|
"""
|
|
669
706
|
if auth_setting['in'] == 'cookie':
|
|
670
|
-
|
|
707
|
+
if not 'Cookie' in headers:
|
|
708
|
+
headers['Cookie'] = ""
|
|
709
|
+
else:
|
|
710
|
+
headers['Cookie'] += "; "
|
|
711
|
+
# Account for cookie value containing spaces and special characters, excluding base64 delimiters
|
|
712
|
+
cookie_value = quote(str(auth_setting['value']), safe="!#$%&'()*+-./:<=>?@[]^_`{|}~%+/=")
|
|
713
|
+
headers['Cookie'] += f"{auth_setting['key']}={cookie_value}"
|
|
671
714
|
elif auth_setting['in'] == 'header':
|
|
672
715
|
if auth_setting['type'] != 'http-signature':
|
|
673
716
|
headers[auth_setting['key']] = auth_setting['value']
|
|
@@ -694,14 +737,16 @@ class ApiClient:
|
|
|
694
737
|
os.close(fd)
|
|
695
738
|
os.remove(path)
|
|
696
739
|
|
|
697
|
-
content_disposition = response.
|
|
740
|
+
content_disposition = response.headers.get("Content-Disposition")
|
|
698
741
|
if content_disposition:
|
|
699
742
|
m = re.search(
|
|
700
743
|
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
|
|
701
744
|
content_disposition
|
|
702
745
|
)
|
|
703
746
|
assert m is not None, "Unexpected 'content-disposition' header value"
|
|
704
|
-
filename = m.group(1)
|
|
747
|
+
filename = os.path.basename(m.group(1)) # Strip any directory traversal
|
|
748
|
+
if filename in ("", ".", ".."): # fall back to tmp filename
|
|
749
|
+
filename = os.path.basename(path)
|
|
705
750
|
path = os.path.join(os.path.dirname(path), filename)
|
|
706
751
|
|
|
707
752
|
with open(path, "wb") as f:
|