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.
Files changed (200) hide show
  1. platform_api_python_client/__init__.py +410 -148
  2. platform_api_python_client/api/external_api.py +6466 -1215
  3. platform_api_python_client/api_client.py +81 -36
  4. platform_api_python_client/configuration.py +262 -66
  5. platform_api_python_client/exceptions.py +24 -5
  6. platform_api_python_client/models/__init__.py +90 -35
  7. platform_api_python_client/models/admission.py +106 -0
  8. platform_api_python_client/models/autoscaling.py +120 -0
  9. platform_api_python_client/models/ccl_dynamo_pools.py +117 -0
  10. platform_api_python_client/models/{create_c_serve_v2_deployment_response.py → ccl_main_pools.py} +16 -16
  11. platform_api_python_client/models/ccluster_catalogs_cluster_base_argo_rollouts_chart_values.py +121 -0
  12. platform_api_python_client/models/{c_serve_v2_recipe.py → ccluster_catalogs_cluster_base_argo_rollouts_controller.py} +15 -18
  13. platform_api_python_client/models/ccluster_catalogs_cluster_base_argo_rollouts_values.py +110 -0
  14. platform_api_python_client/models/ccluster_catalogs_cluster_base_cert_manager_chart_values.py +117 -0
  15. platform_api_python_client/models/ccluster_catalogs_cluster_base_cert_manager_values.py +110 -0
  16. platform_api_python_client/models/ccluster_catalogs_cluster_base_gpu_operator_chart_values.py +152 -0
  17. platform_api_python_client/models/ccluster_catalogs_cluster_base_gpu_operator_values.py +121 -0
  18. platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_chart_values.py +110 -0
  19. platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_controller.py +121 -0
  20. platform_api_python_client/models/ccluster_catalogs_cluster_base_ingress_nginx_values.py +110 -0
  21. platform_api_python_client/models/ccluster_catalogs_cluster_base_istio_values.py +143 -0
  22. platform_api_python_client/models/ccluster_catalogs_cluster_base_kai_scheduler_chart_values.py +154 -0
  23. platform_api_python_client/models/ccluster_catalogs_cluster_base_kai_scheduler_values.py +121 -0
  24. platform_api_python_client/models/ccluster_catalogs_cluster_base_keda_chart_values.py +131 -0
  25. platform_api_python_client/models/ccluster_catalogs_cluster_base_keda_values.py +110 -0
  26. platform_api_python_client/models/ccluster_catalogs_cluster_base_kube_prometheus_stack_chart_values.py +121 -0
  27. platform_api_python_client/models/ccluster_catalogs_cluster_base_kube_prometheus_stack_values.py +121 -0
  28. platform_api_python_client/models/ccluster_catalogs_cluster_base_metrics_server_chart_values.py +106 -0
  29. platform_api_python_client/models/ccluster_catalogs_cluster_base_metrics_server_values.py +110 -0
  30. platform_api_python_client/models/cdi.py +113 -0
  31. platform_api_python_client/models/cluster_base_components.py +187 -0
  32. platform_api_python_client/models/cluster_capacity_response.py +5 -5
  33. platform_api_python_client/models/cluster_credential.py +6 -5
  34. platform_api_python_client/models/cluster_registration_request.py +4 -3
  35. platform_api_python_client/models/cluster_registration_response.py +4 -3
  36. platform_api_python_client/models/{istio_cni_overrides.py → cni.py} +29 -15
  37. platform_api_python_client/models/config_file_mount.py +6 -5
  38. platform_api_python_client/models/create_compute_deployment_request.py +35 -9
  39. platform_api_python_client/models/create_compute_deployment_response.py +4 -3
  40. platform_api_python_client/models/create_dynamo_deployment_request.py +67 -20
  41. platform_api_python_client/models/create_dynamo_deployment_response.py +4 -3
  42. platform_api_python_client/models/create_filesystem_volume_request.py +8 -20
  43. platform_api_python_client/models/create_hardware_instance_request.py +4 -3
  44. platform_api_python_client/models/create_inference_deployment_response.py +4 -3
  45. platform_api_python_client/models/create_inference_v3_deployment_request.py +52 -10
  46. platform_api_python_client/models/create_job_deployment_request.py +35 -9
  47. platform_api_python_client/models/create_job_deployment_response.py +4 -3
  48. platform_api_python_client/models/create_object_volume_request.py +10 -22
  49. platform_api_python_client/models/create_organization_request.py +4 -3
  50. platform_api_python_client/models/create_organization_response.py +4 -3
  51. platform_api_python_client/models/create_service_account_request.py +4 -3
  52. platform_api_python_client/models/create_service_account_response.py +4 -3
  53. platform_api_python_client/models/credits_response.py +4 -3
  54. platform_api_python_client/models/daily_bill_response.py +4 -3
  55. platform_api_python_client/models/{fluent_bit.py → dashboard.py} +29 -12
  56. platform_api_python_client/models/{prometheus_adapter.py → default_priorities.py} +29 -12
  57. platform_api_python_client/models/default_queue.py +106 -0
  58. platform_api_python_client/models/delete_user_vault_item_request.py +4 -3
  59. platform_api_python_client/models/deployment_log_event_v4.py +4 -3
  60. platform_api_python_client/models/deployment_response.py +12 -27
  61. platform_api_python_client/models/deployment_status_request.py +4 -3
  62. platform_api_python_client/models/deployment_status_response.py +4 -3
  63. platform_api_python_client/models/deployment_status_v3_response.py +5 -5
  64. platform_api_python_client/models/deployment_type.py +14 -0
  65. platform_api_python_client/models/deployment_usage.py +5 -5
  66. platform_api_python_client/models/deployment_usage_value.py +4 -3
  67. platform_api_python_client/models/dynamo_communications_input.py +4 -16
  68. platform_api_python_client/models/dynamo_frontend_config.py +105 -0
  69. platform_api_python_client/models/dynamo_frontend_config_response.py +105 -0
  70. platform_api_python_client/models/dynamo_image.py +106 -0
  71. platform_api_python_client/models/dynamo_kv_transfer_configuration.py +4 -16
  72. platform_api_python_client/models/{external_dns.py → dynamo_weight_transfer_configuration.py} +13 -13
  73. platform_api_python_client/models/dynamo_weight_transfer_policy.py +36 -0
  74. platform_api_python_client/models/dynamo_worker_pool_config.py +6 -18
  75. platform_api_python_client/models/dynamo_worker_pools.py +4 -16
  76. platform_api_python_client/models/{keda.py → env.py} +14 -13
  77. platform_api_python_client/models/generate_service_account_secret_response.py +4 -3
  78. platform_api_python_client/models/get_cluster_response.py +8 -5
  79. platform_api_python_client/models/get_compute_deployment_response.py +35 -8
  80. platform_api_python_client/models/get_deployment_log_response.py +4 -3
  81. platform_api_python_client/models/get_deployment_log_v4_response.py +5 -5
  82. platform_api_python_client/models/get_deployment_pods_response.py +4 -3
  83. platform_api_python_client/models/get_deployment_response.py +7 -7
  84. platform_api_python_client/models/get_deployment_revision_response.py +4 -3
  85. platform_api_python_client/models/get_deployment_usage_response.py +24 -9
  86. platform_api_python_client/models/get_dynamo_deployment_response.py +63 -15
  87. platform_api_python_client/models/get_filesystem_volume_response.py +4 -3
  88. platform_api_python_client/models/get_inference_deployment_response.py +7 -7
  89. platform_api_python_client/models/get_inference_v3_deployment_response.py +51 -8
  90. platform_api_python_client/models/get_job_deployment_response.py +35 -8
  91. platform_api_python_client/models/get_object_volume_response.py +4 -3
  92. platform_api_python_client/models/gpu_type_capacity.py +4 -3
  93. platform_api_python_client/models/hardware_instance_response.py +10 -5
  94. platform_api_python_client/models/hardware_preset_response.py +4 -3
  95. platform_api_python_client/models/http_validation_error.py +5 -5
  96. platform_api_python_client/models/image.py +113 -0
  97. platform_api_python_client/models/image_pull_secret_credentials.py +4 -3
  98. platform_api_python_client/models/{istio_cni_subchart_overrides.py → ingress.py} +26 -18
  99. platform_api_python_client/models/{c_serve_recipe_response.py → insight_list_item_response.py} +33 -27
  100. platform_api_python_client/models/{create_c_serve_v3_deployment_response.py → insight_resource.py} +20 -14
  101. platform_api_python_client/models/insight_resource_type.py +37 -0
  102. platform_api_python_client/models/insight_response.py +133 -0
  103. platform_api_python_client/models/insight_severity.py +40 -0
  104. platform_api_python_client/models/insight_status.py +39 -0
  105. platform_api_python_client/models/insight_status_change_response.py +108 -0
  106. platform_api_python_client/models/invite_user_request.py +4 -3
  107. platform_api_python_client/models/istio_base.py +106 -0
  108. platform_api_python_client/models/istio_cni.py +124 -0
  109. platform_api_python_client/models/{ingress_nginx.py → istio_gateway.py} +29 -12
  110. platform_api_python_client/models/{dynamo_communications_output.py → istiod.py} +21 -15
  111. platform_api_python_client/models/list_cluster_capacity_response.py +5 -5
  112. platform_api_python_client/models/list_daily_bill_response.py +5 -5
  113. platform_api_python_client/models/list_deployment_revisions_response.py +5 -5
  114. platform_api_python_client/models/list_get_cluster_response.py +5 -5
  115. platform_api_python_client/models/list_get_deployment_response.py +5 -5
  116. platform_api_python_client/models/list_hardware_instance_response.py +5 -5
  117. platform_api_python_client/models/list_hardware_preset_response.py +5 -5
  118. platform_api_python_client/models/{istio_overrides.py → list_insights_response.py} +19 -20
  119. platform_api_python_client/models/list_organization_gpu_quota_response.py +5 -5
  120. platform_api_python_client/models/list_prebuilt_image_response.py +5 -5
  121. platform_api_python_client/models/list_service_accounts_response.py +5 -5
  122. platform_api_python_client/models/list_user_vault_items_response.py +5 -5
  123. platform_api_python_client/models/list_volumes_response.py +5 -5
  124. platform_api_python_client/models/{validation_error_loc_inner.py → location_inner.py} +6 -6
  125. platform_api_python_client/models/metric.py +13 -0
  126. platform_api_python_client/models/metrics.py +117 -0
  127. platform_api_python_client/models/metrics_config.py +6 -5
  128. platform_api_python_client/models/mig.py +106 -0
  129. platform_api_python_client/models/operator.py +117 -0
  130. platform_api_python_client/models/organization_gpu_quota_request.py +4 -3
  131. platform_api_python_client/models/organization_gpu_quota_response.py +4 -3
  132. platform_api_python_client/models/pilot.py +106 -0
  133. platform_api_python_client/models/pod_details.py +4 -3
  134. platform_api_python_client/models/pool.py +117 -0
  135. platform_api_python_client/models/prebuilt_image_response.py +4 -3
  136. platform_api_python_client/models/prometheus.py +110 -0
  137. platform_api_python_client/models/prometheus_rules.py +120 -0
  138. platform_api_python_client/models/prometheus_spec.py +113 -0
  139. platform_api_python_client/models/prometheus_values.py +117 -0
  140. platform_api_python_client/models/quota.py +106 -0
  141. platform_api_python_client/models/replicas.py +106 -0
  142. platform_api_python_client/models/resource_list.py +113 -0
  143. platform_api_python_client/models/resource_requirements.py +120 -0
  144. platform_api_python_client/models/revision_pod_details.py +5 -5
  145. platform_api_python_client/models/rollout_strategy_params.py +4 -3
  146. platform_api_python_client/models/scheduler.py +117 -0
  147. platform_api_python_client/models/service_account_response.py +4 -3
  148. platform_api_python_client/models/{istio.py → toggle.py} +27 -19
  149. platform_api_python_client/models/toleration.py +134 -0
  150. platform_api_python_client/models/unified_get_compute_deployment_response.py +177 -0
  151. platform_api_python_client/models/{c_serve_recipe_perf.py → unified_get_deployment_logs_response.py} +19 -22
  152. platform_api_python_client/models/{longhorn.py → unified_get_deployment_pods_response.py} +13 -14
  153. platform_api_python_client/models/unified_get_deployment_response.py +164 -0
  154. platform_api_python_client/models/unified_get_deployment_revision_response.py +110 -0
  155. platform_api_python_client/models/{argo_rollouts.py → unified_get_deployment_rollout_response.py} +15 -13
  156. platform_api_python_client/models/unified_get_deployment_usage_response.py +110 -0
  157. platform_api_python_client/models/unified_get_dynamo_deployment_response.py +218 -0
  158. platform_api_python_client/models/unified_get_inference_v3_deployment_response.py +228 -0
  159. platform_api_python_client/models/unified_get_job_deployment_response.py +204 -0
  160. platform_api_python_client/models/{list_c_serve_recipe_response.py → unified_list_deployment_revisions_response.py} +12 -12
  161. platform_api_python_client/models/{spire.py → unified_update_deployment_rollout_request.py} +12 -13
  162. platform_api_python_client/models/unified_write_compute_deployment_request.py +154 -0
  163. platform_api_python_client/models/unified_write_deployment_request.py +164 -0
  164. platform_api_python_client/models/unified_write_deployment_response.py +110 -0
  165. platform_api_python_client/models/unified_write_dynamo_deployment_request.py +197 -0
  166. platform_api_python_client/models/{create_c_serve_v3_deployment_request.py → unified_write_inference_v3_deployment_request.py} +86 -78
  167. platform_api_python_client/models/unified_write_job_deployment_request.py +183 -0
  168. platform_api_python_client/models/update_cluster_metadata_request.py +4 -3
  169. platform_api_python_client/models/{cluster_config.py → update_cluster_request.py} +11 -10
  170. platform_api_python_client/models/update_deployment_response.py +4 -3
  171. platform_api_python_client/models/update_deployment_status_v3_request.py +4 -3
  172. platform_api_python_client/models/update_insight_status_request.py +107 -0
  173. platform_api_python_client/models/update_service_account_request.py +4 -3
  174. platform_api_python_client/models/upsert_user_vault_item_request.py +5 -4
  175. platform_api_python_client/models/usage_availability.py +40 -0
  176. platform_api_python_client/models/usage_component.py +39 -0
  177. platform_api_python_client/models/user_vault_item.py +4 -3
  178. platform_api_python_client/models/validation_error.py +8 -8
  179. platform_api_python_client/models/volume_mount.py +4 -3
  180. platform_api_python_client/models/volume_status_response.py +4 -3
  181. platform_api_python_client/models/workload.py +110 -0
  182. platform_api_python_client/rest.py +87 -10
  183. platform_api_python_client-4.41.0.dist-info/METADATA +418 -0
  184. platform_api_python_client-4.41.0.dist-info/RECORD +206 -0
  185. {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.41.0.dist-info}/WHEEL +1 -1
  186. platform_api_python_client/models/cert_manager.py +0 -89
  187. platform_api_python_client/models/cluster_components.py +0 -193
  188. platform_api_python_client/models/final_stack.py +0 -89
  189. platform_api_python_client/models/get_c_serve_v2_deployment_response.py +0 -193
  190. platform_api_python_client/models/get_c_serve_v3_deployment_response.py +0 -194
  191. platform_api_python_client/models/gpu_operator.py +0 -89
  192. platform_api_python_client/models/kube_prometheus_stack.py +0 -89
  193. platform_api_python_client/models/metrics_server.py +0 -89
  194. platform_api_python_client/models/network_operator.py +0 -89
  195. platform_api_python_client/models/opentelemetry_collector.py +0 -89
  196. platform_api_python_client/models/spire_crds.py +0 -89
  197. platform_api_python_client/models/teleport_kube_agent.py +0 -89
  198. platform_api_python_client-4.31.0.dist-info/METADATA +0 -23
  199. platform_api_python_client-4.31.0.dist-info/RECORD +0 -151
  200. {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.31.0/python'
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 == "bytearray":
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.getheader('content-type')
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.getheaders(),
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
- obj_dict = obj
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
- # Convert model obj to dict except
376
- # attributes `openapi_types`, `attribute_map`
377
- # and attributes which value is not None.
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!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
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 == object:
470
+ elif klass is object:
457
471
  return self.__deserialize_object(data)
458
- elif klass == datetime.date:
472
+ elif klass is datetime.date:
459
473
  return self.__deserialize_date(data)
460
- elif klass == datetime.datetime:
474
+ elif klass is datetime.datetime:
461
475
  return self.__deserialize_datetime(data)
462
- elif klass == decimal.Decimal:
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((k, value) for value in v)
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(str(value) for value in v)))
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
- if k in collection_formats:
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((k, str(value)) for value in v)
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(quote(str(value)) for value in v))
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
- new_params.append((k, quote(str(v))))
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
- headers['Cookie'] = auth_setting['value']
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.getheader("Content-Disposition")
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: