crypticorn 2.4.7__py3-none-any.whl → 2.5.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 (76) hide show
  1. crypticorn/cli/init.py +7 -4
  2. crypticorn/common/__init__.py +1 -0
  3. crypticorn/common/auth.py +7 -3
  4. crypticorn/common/errors.py +21 -0
  5. crypticorn/common/exceptions.py +83 -0
  6. crypticorn/common/utils.py +11 -4
  7. crypticorn/klines/client/__init__.py +10 -3
  8. crypticorn/klines/client/api/__init__.py +1 -0
  9. crypticorn/klines/client/api/change_in_timeframe_api.py +331 -0
  10. crypticorn/klines/client/api/funding_rates_api.py +13 -13
  11. crypticorn/klines/client/api/health_check_api.py +8 -8
  12. crypticorn/klines/client/api/ohlcv_data_api.py +38 -26
  13. crypticorn/klines/client/api/symbols_api.py +26 -20
  14. crypticorn/klines/client/api/udf_api.py +229 -229
  15. crypticorn/klines/client/api_client.py +8 -5
  16. crypticorn/klines/client/configuration.py +80 -37
  17. crypticorn/klines/client/models/__init__.py +9 -3
  18. crypticorn/klines/client/models/base_response_list_change_in_timeframe_response.py +123 -0
  19. crypticorn/klines/client/models/change_in_timeframe_response.py +86 -0
  20. crypticorn/klines/client/models/market_type.py +35 -0
  21. crypticorn/klines/client/models/response_get_udf_history.py +198 -0
  22. crypticorn/klines/client/rest.py +111 -159
  23. crypticorn/klines/main.py +32 -22
  24. crypticorn/metrics/main.py +39 -40
  25. crypticorn/pay/client/__init__.py +0 -3
  26. crypticorn/pay/client/api/now_payments_api.py +1 -53
  27. crypticorn/pay/client/models/__init__.py +0 -3
  28. crypticorn/pay/client/models/payment.py +3 -3
  29. crypticorn/pay/client/models/scope.py +6 -1
  30. crypticorn/trade/client/__init__.py +8 -6
  31. crypticorn/trade/client/api/__init__.py +0 -1
  32. crypticorn/trade/client/api/api_keys_api.py +167 -273
  33. crypticorn/trade/client/api/bots_api.py +140 -226
  34. crypticorn/trade/client/api/exchanges_api.py +31 -51
  35. crypticorn/trade/client/api/futures_trading_panel_api.py +169 -272
  36. crypticorn/trade/client/api/notifications_api.py +200 -323
  37. crypticorn/trade/client/api/orders_api.py +40 -60
  38. crypticorn/trade/client/api/status_api.py +31 -49
  39. crypticorn/trade/client/api/strategies_api.py +137 -223
  40. crypticorn/trade/client/api/trading_actions_api.py +106 -170
  41. crypticorn/trade/client/api_client.py +111 -153
  42. crypticorn/trade/client/api_response.py +2 -3
  43. crypticorn/trade/client/configuration.py +128 -115
  44. crypticorn/trade/client/exceptions.py +25 -21
  45. crypticorn/trade/client/models/__init__.py +8 -6
  46. crypticorn/trade/client/models/action_model.py +108 -54
  47. crypticorn/trade/client/models/api_error_identifier.py +76 -72
  48. crypticorn/trade/client/models/api_error_level.py +9 -11
  49. crypticorn/trade/client/models/api_error_type.py +9 -11
  50. crypticorn/trade/client/models/bot_model.py +57 -36
  51. crypticorn/trade/client/models/bot_status.py +9 -11
  52. crypticorn/trade/client/models/exchange.py +7 -9
  53. crypticorn/trade/client/models/exchange_key_model.py +43 -32
  54. crypticorn/trade/client/models/execution_ids.py +18 -18
  55. crypticorn/trade/client/models/futures_balance.py +43 -27
  56. crypticorn/trade/client/models/futures_trading_action.py +102 -50
  57. crypticorn/trade/client/models/http_validation_error.py +19 -15
  58. crypticorn/trade/client/models/margin_mode.py +7 -9
  59. crypticorn/trade/client/models/market_type.py +7 -9
  60. crypticorn/trade/client/models/notification_model.py +52 -32
  61. crypticorn/trade/client/models/order_model.py +112 -72
  62. crypticorn/trade/client/models/order_status.py +10 -12
  63. crypticorn/trade/client/models/post_futures_action.py +20 -16
  64. crypticorn/trade/client/models/strategy_exchange_info.py +15 -16
  65. crypticorn/trade/client/models/strategy_model_input.py +61 -33
  66. crypticorn/trade/client/models/strategy_model_output.py +61 -33
  67. crypticorn/trade/client/models/tpsl.py +39 -25
  68. crypticorn/trade/client/models/trading_action_type.py +9 -11
  69. crypticorn/trade/client/models/validation_error.py +24 -18
  70. crypticorn/trade/client/models/validation_error_loc_inner.py +37 -16
  71. crypticorn/trade/client/rest.py +23 -38
  72. {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/METADATA +1 -1
  73. {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/RECORD +76 -70
  74. {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/WHEEL +1 -1
  75. {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/entry_points.txt +0 -0
  76. {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/top_level.txt +0 -0
@@ -1,14 +1,14 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- Trading API
4
+ Trading API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.1.0
9
- Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
- Do not edit the class manually.
11
+ Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
14
 
@@ -37,11 +37,12 @@ from crypticorn.trade.client.exceptions import (
37
37
  UnauthorizedException,
38
38
  ForbiddenException,
39
39
  NotFoundException,
40
- ServiceException
40
+ ServiceException,
41
41
  )
42
42
 
43
43
  RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]]
44
44
 
45
+
45
46
  class ApiClient:
46
47
  """Generic API client for OpenAPI client library builds.
47
48
 
@@ -60,24 +61,20 @@ class ApiClient:
60
61
 
61
62
  PRIMITIVE_TYPES = (float, bool, bytes, str, int)
62
63
  NATIVE_TYPES_MAPPING = {
63
- 'int': int,
64
- 'long': int, # TODO remove as only py3 is supported?
65
- 'float': float,
66
- 'str': str,
67
- 'bool': bool,
68
- 'date': datetime.date,
69
- 'datetime': datetime.datetime,
70
- 'decimal': decimal.Decimal,
71
- 'object': object,
64
+ "int": int,
65
+ "long": int, # TODO remove as only py3 is supported?
66
+ "float": float,
67
+ "str": str,
68
+ "bool": bool,
69
+ "date": datetime.date,
70
+ "datetime": datetime.datetime,
71
+ "decimal": decimal.Decimal,
72
+ "object": object,
72
73
  }
73
74
  _pool = None
74
75
 
75
76
  def __init__(
76
- self,
77
- configuration=None,
78
- header_name=None,
79
- header_value=None,
80
- cookie=None
77
+ self, configuration=None, header_name=None, header_value=None, cookie=None
81
78
  ) -> None:
82
79
  # use default configuration if none is provided
83
80
  if configuration is None:
@@ -90,7 +87,7 @@ class ApiClient:
90
87
  self.default_headers[header_name] = header_value
91
88
  self.cookie = cookie
92
89
  # Set default User-Agent.
93
- self.user_agent = 'OpenAPI-Generator/1.0.0/python'
90
+ self.user_agent = "OpenAPI-Generator/1.0.0/python"
94
91
  self.client_side_validation = configuration.client_side_validation
95
92
 
96
93
  async def __aenter__(self):
@@ -105,16 +102,15 @@ class ApiClient:
105
102
  @property
106
103
  def user_agent(self):
107
104
  """User agent for this API client"""
108
- return self.default_headers['User-Agent']
105
+ return self.default_headers["User-Agent"]
109
106
 
110
107
  @user_agent.setter
111
108
  def user_agent(self, value):
112
- self.default_headers['User-Agent'] = value
109
+ self.default_headers["User-Agent"] = value
113
110
 
114
111
  def set_default_header(self, header_name, header_value):
115
112
  self.default_headers[header_name] = header_value
116
113
 
117
-
118
114
  _default = None
119
115
 
120
116
  @classmethod
@@ -150,12 +146,12 @@ class ApiClient:
150
146
  header_params=None,
151
147
  body=None,
152
148
  post_params=None,
153
- files=None, auth_settings=None,
149
+ files=None,
150
+ auth_settings=None,
154
151
  collection_formats=None,
155
152
  _host=None,
156
- _request_auth=None
153
+ _request_auth=None,
157
154
  ) -> RequestSerialized:
158
-
159
155
  """Builds the HTTP request params needed by the request.
160
156
  :param method: Method to call.
161
157
  :param resource_path: Path to method endpoint.
@@ -184,35 +180,28 @@ class ApiClient:
184
180
  header_params = header_params or {}
185
181
  header_params.update(self.default_headers)
186
182
  if self.cookie:
187
- header_params['Cookie'] = self.cookie
183
+ header_params["Cookie"] = self.cookie
188
184
  if header_params:
189
185
  header_params = self.sanitize_for_serialization(header_params)
190
186
  header_params = dict(
191
- self.parameters_to_tuples(header_params,collection_formats)
187
+ self.parameters_to_tuples(header_params, collection_formats)
192
188
  )
193
189
 
194
190
  # path parameters
195
191
  if path_params:
196
192
  path_params = self.sanitize_for_serialization(path_params)
197
- path_params = self.parameters_to_tuples(
198
- path_params,
199
- collection_formats
200
- )
193
+ path_params = self.parameters_to_tuples(path_params, collection_formats)
201
194
  for k, v in path_params:
202
195
  # specified safe chars, encode everything
203
196
  resource_path = resource_path.replace(
204
- '{%s}' % k,
205
- quote(str(v), safe=config.safe_chars_for_path_param)
197
+ "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param)
206
198
  )
207
199
 
208
200
  # post parameters
209
201
  if post_params or files:
210
202
  post_params = post_params if post_params else []
211
203
  post_params = self.sanitize_for_serialization(post_params)
212
- post_params = self.parameters_to_tuples(
213
- post_params,
214
- collection_formats
215
- )
204
+ post_params = self.parameters_to_tuples(post_params, collection_formats)
216
205
  if files:
217
206
  post_params.extend(self.files_parameters(files))
218
207
 
@@ -224,7 +213,7 @@ class ApiClient:
224
213
  resource_path,
225
214
  method,
226
215
  body,
227
- request_auth=_request_auth
216
+ request_auth=_request_auth,
228
217
  )
229
218
 
230
219
  # body
@@ -241,15 +230,11 @@ class ApiClient:
241
230
  # query parameters
242
231
  if query_params:
243
232
  query_params = self.sanitize_for_serialization(query_params)
244
- url_query = self.parameters_to_url_query(
245
- query_params,
246
- collection_formats
247
- )
233
+ url_query = self.parameters_to_url_query(query_params, collection_formats)
248
234
  url += "?" + url_query
249
235
 
250
236
  return method, url, header_params, body, post_params
251
237
 
252
-
253
238
  async def call_api(
254
239
  self,
255
240
  method,
@@ -257,7 +242,7 @@ class ApiClient:
257
242
  header_params=None,
258
243
  body=None,
259
244
  post_params=None,
260
- _request_timeout=None
245
+ _request_timeout=None,
261
246
  ) -> rest.RESTResponse:
262
247
  """Makes the HTTP request (synchronous)
263
248
  :param method: Method to call.
@@ -274,10 +259,12 @@ class ApiClient:
274
259
  try:
275
260
  # perform request and return response
276
261
  response_data = await self.rest_client.request(
277
- method, url,
262
+ method,
263
+ url,
278
264
  headers=header_params,
279
- body=body, post_params=post_params,
280
- _request_timeout=_request_timeout
265
+ body=body,
266
+ post_params=post_params,
267
+ _request_timeout=_request_timeout,
281
268
  )
282
269
 
283
270
  except ApiException as e:
@@ -288,7 +275,7 @@ class ApiClient:
288
275
  def response_deserialize(
289
276
  self,
290
277
  response_data: rest.RESTResponse,
291
- response_types_map: Optional[Dict[str, ApiResponseT]]=None
278
+ response_types_map: Optional[Dict[str, ApiResponseT]] = None,
292
279
  ) -> ApiResponse[ApiResponseT]:
293
280
  """Deserializes response into an object.
294
281
  :param response_data: RESTResponse object to be deserialized.
@@ -300,9 +287,15 @@ class ApiClient:
300
287
  assert response_data.data is not None, msg
301
288
 
302
289
  response_type = response_types_map.get(str(response_data.status), None)
303
- if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
290
+ if (
291
+ not response_type
292
+ and isinstance(response_data.status, int)
293
+ and 100 <= response_data.status <= 599
294
+ ):
304
295
  # if not found, look for '1XX', '2XX', etc.
305
- response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)
296
+ response_type = response_types_map.get(
297
+ str(response_data.status)[0] + "XX", None
298
+ )
306
299
 
307
300
  # deserialize response data
308
301
  response_text = None
@@ -314,12 +307,14 @@ class ApiClient:
314
307
  return_data = self.__deserialize_file(response_data)
315
308
  elif response_type is not None:
316
309
  match = None
317
- content_type = response_data.getheader('content-type')
310
+ content_type = response_data.getheader("content-type")
318
311
  if content_type is not None:
319
312
  match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
320
313
  encoding = match.group(1) if match else "utf-8"
321
314
  response_text = response_data.data.decode(encoding)
322
- return_data = self.deserialize(response_text, response_type, content_type)
315
+ return_data = self.deserialize(
316
+ response_text, response_type, content_type
317
+ )
323
318
  finally:
324
319
  if not 200 <= response_data.status <= 299:
325
320
  raise ApiException.from_response(
@@ -329,10 +324,10 @@ class ApiClient:
329
324
  )
330
325
 
331
326
  return ApiResponse(
332
- status_code = response_data.status,
333
- data = return_data,
334
- headers = response_data.getheaders(),
335
- raw_data = response_data.data
327
+ status_code=response_data.status,
328
+ data=return_data,
329
+ headers=response_data.getheaders(),
330
+ raw_data=response_data.data,
336
331
  )
337
332
 
338
333
  def sanitize_for_serialization(self, obj):
@@ -360,13 +355,9 @@ class ApiClient:
360
355
  elif isinstance(obj, self.PRIMITIVE_TYPES):
361
356
  return obj
362
357
  elif isinstance(obj, list):
363
- return [
364
- self.sanitize_for_serialization(sub_obj) for sub_obj in obj
365
- ]
358
+ return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj]
366
359
  elif isinstance(obj, tuple):
367
- return tuple(
368
- self.sanitize_for_serialization(sub_obj) for sub_obj in obj
369
- )
360
+ return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj)
370
361
  elif isinstance(obj, (datetime.datetime, datetime.date)):
371
362
  return obj.isoformat()
372
363
  elif isinstance(obj, decimal.Decimal):
@@ -380,17 +371,18 @@ class ApiClient:
380
371
  # and attributes which value is not None.
381
372
  # Convert attribute name to json key in
382
373
  # model definition for request.
383
- if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
374
+ if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")):
384
375
  obj_dict = obj.to_dict()
385
376
  else:
386
377
  obj_dict = obj.__dict__
387
378
 
388
379
  return {
389
- key: self.sanitize_for_serialization(val)
390
- for key, val in obj_dict.items()
380
+ key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()
391
381
  }
392
382
 
393
- def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
383
+ def deserialize(
384
+ self, response_text: str, response_type: str, content_type: Optional[str]
385
+ ):
394
386
  """Deserializes response into an object.
395
387
 
396
388
  :param response: RESTResponse object to be deserialized.
@@ -407,17 +399,20 @@ class ApiClient:
407
399
  data = json.loads(response_text)
408
400
  except ValueError:
409
401
  data = response_text
410
- elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
402
+ elif re.match(
403
+ r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)",
404
+ content_type,
405
+ re.IGNORECASE,
406
+ ):
411
407
  if response_text == "":
412
408
  data = ""
413
409
  else:
414
410
  data = json.loads(response_text)
415
- elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
411
+ elif re.match(r"^text\/[a-z.+-]+\s*(;|$)", content_type, re.IGNORECASE):
416
412
  data = response_text
417
413
  else:
418
414
  raise ApiException(
419
- status=0,
420
- reason="Unsupported content type: {0}".format(content_type)
415
+ status=0, reason="Unsupported content type: {0}".format(content_type)
421
416
  )
422
417
 
423
418
  return self.__deserialize(data, response_type)
@@ -434,19 +429,17 @@ class ApiClient:
434
429
  return None
435
430
 
436
431
  if isinstance(klass, str):
437
- if klass.startswith('List['):
438
- m = re.match(r'List\[(.*)]', klass)
432
+ if klass.startswith("List["):
433
+ m = re.match(r"List\[(.*)]", klass)
439
434
  assert m is not None, "Malformed List type definition"
440
435
  sub_kls = m.group(1)
441
- return [self.__deserialize(sub_data, sub_kls)
442
- for sub_data in data]
436
+ return [self.__deserialize(sub_data, sub_kls) for sub_data in data]
443
437
 
444
- if klass.startswith('Dict['):
445
- m = re.match(r'Dict\[([^,]*), (.*)]', klass)
438
+ if klass.startswith("Dict["):
439
+ m = re.match(r"Dict\[([^,]*), (.*)]", klass)
446
440
  assert m is not None, "Malformed Dict type definition"
447
441
  sub_kls = m.group(2)
448
- return {k: self.__deserialize(v, sub_kls)
449
- for k, v in data.items()}
442
+ return {k: self.__deserialize(v, sub_kls) for k, v in data.items()}
450
443
 
451
444
  # convert str to class
452
445
  if klass in self.NATIVE_TYPES_MAPPING:
@@ -482,19 +475,18 @@ class ApiClient:
482
475
  for k, v in params.items() if isinstance(params, dict) else params:
483
476
  if k in collection_formats:
484
477
  collection_format = collection_formats[k]
485
- if collection_format == 'multi':
478
+ if collection_format == "multi":
486
479
  new_params.extend((k, value) for value in v)
487
480
  else:
488
- if collection_format == 'ssv':
489
- delimiter = ' '
490
- elif collection_format == 'tsv':
491
- delimiter = '\t'
492
- elif collection_format == 'pipes':
493
- delimiter = '|'
481
+ if collection_format == "ssv":
482
+ delimiter = " "
483
+ elif collection_format == "tsv":
484
+ delimiter = "\t"
485
+ elif collection_format == "pipes":
486
+ delimiter = "|"
494
487
  else: # csv is the default
495
- delimiter = ','
496
- new_params.append(
497
- (k, delimiter.join(str(value) for value in v)))
488
+ delimiter = ","
489
+ new_params.append((k, delimiter.join(str(value) for value in v)))
498
490
  else:
499
491
  new_params.append((k, v))
500
492
  return new_params
@@ -519,17 +511,17 @@ class ApiClient:
519
511
 
520
512
  if k in collection_formats:
521
513
  collection_format = collection_formats[k]
522
- if collection_format == 'multi':
514
+ if collection_format == "multi":
523
515
  new_params.extend((k, quote(str(value))) for value in v)
524
516
  else:
525
- if collection_format == 'ssv':
526
- delimiter = ' '
527
- elif collection_format == 'tsv':
528
- delimiter = '\t'
529
- elif collection_format == 'pipes':
530
- delimiter = '|'
517
+ if collection_format == "ssv":
518
+ delimiter = " "
519
+ elif collection_format == "tsv":
520
+ delimiter = "\t"
521
+ elif collection_format == "pipes":
522
+ delimiter = "|"
531
523
  else: # csv is the default
532
- delimiter = ','
524
+ delimiter = ","
533
525
  new_params.append(
534
526
  (k, delimiter.join(quote(str(value)) for value in v))
535
527
  )
@@ -550,7 +542,7 @@ class ApiClient:
550
542
  params = []
551
543
  for k, v in files.items():
552
544
  if isinstance(v, str):
553
- with open(v, 'rb') as f:
545
+ with open(v, "rb") as f:
554
546
  filename = os.path.basename(f.name)
555
547
  filedata = f.read()
556
548
  elif isinstance(v, bytes):
@@ -564,13 +556,8 @@ class ApiClient:
564
556
  continue
565
557
  else:
566
558
  raise ValueError("Unsupported file value")
567
- mimetype = (
568
- mimetypes.guess_type(filename)[0]
569
- or 'application/octet-stream'
570
- )
571
- params.append(
572
- tuple([k, tuple([filename, filedata, mimetype])])
573
- )
559
+ mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream"
560
+ params.append(tuple([k, tuple([filename, filedata, mimetype])]))
574
561
  return params
575
562
 
576
563
  def select_header_accept(self, accepts: List[str]) -> Optional[str]:
@@ -583,7 +570,7 @@ class ApiClient:
583
570
  return None
584
571
 
585
572
  for accept in accepts:
586
- if re.search('json', accept, re.IGNORECASE):
573
+ if re.search("json", accept, re.IGNORECASE):
587
574
  return accept
588
575
 
589
576
  return accepts[0]
@@ -598,7 +585,7 @@ class ApiClient:
598
585
  return None
599
586
 
600
587
  for content_type in content_types:
601
- if re.search('json', content_type, re.IGNORECASE):
588
+ if re.search("json", content_type, re.IGNORECASE):
602
589
  return content_type
603
590
 
604
591
  return content_types[0]
@@ -611,7 +598,7 @@ class ApiClient:
611
598
  resource_path,
612
599
  method,
613
600
  body,
614
- request_auth=None
601
+ request_auth=None,
615
602
  ) -> None:
616
603
  """Updates header and query params based on authentication setting.
617
604
 
@@ -630,34 +617,18 @@ class ApiClient:
630
617
 
631
618
  if request_auth:
632
619
  self._apply_auth_params(
633
- headers,
634
- queries,
635
- resource_path,
636
- method,
637
- body,
638
- request_auth
620
+ headers, queries, resource_path, method, body, request_auth
639
621
  )
640
622
  else:
641
623
  for auth in auth_settings:
642
624
  auth_setting = self.configuration.auth_settings().get(auth)
643
625
  if auth_setting:
644
626
  self._apply_auth_params(
645
- headers,
646
- queries,
647
- resource_path,
648
- method,
649
- body,
650
- auth_setting
627
+ headers, queries, resource_path, method, body, auth_setting
651
628
  )
652
629
 
653
630
  def _apply_auth_params(
654
- self,
655
- headers,
656
- queries,
657
- resource_path,
658
- method,
659
- body,
660
- auth_setting
631
+ self, headers, queries, resource_path, method, body, auth_setting
661
632
  ) -> None:
662
633
  """Updates the request parameters based on a single auth_setting
663
634
 
@@ -669,17 +640,15 @@ class ApiClient:
669
640
  The object type is the return value of sanitize_for_serialization().
670
641
  :param auth_setting: auth settings for the endpoint
671
642
  """
672
- if auth_setting['in'] == 'cookie':
673
- headers['Cookie'] = auth_setting['value']
674
- elif auth_setting['in'] == 'header':
675
- if auth_setting['type'] != 'http-signature':
676
- headers[auth_setting['key']] = auth_setting['value']
677
- elif auth_setting['in'] == 'query':
678
- queries.append((auth_setting['key'], auth_setting['value']))
643
+ if auth_setting["in"] == "cookie":
644
+ headers["Cookie"] = auth_setting["value"]
645
+ elif auth_setting["in"] == "header":
646
+ if auth_setting["type"] != "http-signature":
647
+ headers[auth_setting["key"]] = auth_setting["value"]
648
+ elif auth_setting["in"] == "query":
649
+ queries.append((auth_setting["key"], auth_setting["value"]))
679
650
  else:
680
- raise ApiValueError(
681
- 'Authentication token must be in `query` or `header`'
682
- )
651
+ raise ApiValueError("Authentication token must be in `query` or `header`")
683
652
 
684
653
  def __deserialize_file(self, response):
685
654
  """Deserializes body to file
@@ -699,10 +668,7 @@ class ApiClient:
699
668
 
700
669
  content_disposition = response.getheader("Content-Disposition")
701
670
  if content_disposition:
702
- m = re.search(
703
- r'filename=[\'"]?([^\'"\s]+)[\'"]?',
704
- content_disposition
705
- )
671
+ m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition)
706
672
  assert m is not None, "Unexpected 'content-disposition' header value"
707
673
  filename = m.group(1)
708
674
  path = os.path.join(os.path.dirname(path), filename)
@@ -746,8 +712,7 @@ class ApiClient:
746
712
  return string
747
713
  except ValueError:
748
714
  raise rest.ApiException(
749
- status=0,
750
- reason="Failed to parse `{0}` as date object".format(string)
715
+ status=0, reason="Failed to parse `{0}` as date object".format(string)
751
716
  )
752
717
 
753
718
  def __deserialize_datetime(self, string):
@@ -765,10 +730,7 @@ class ApiClient:
765
730
  except ValueError:
766
731
  raise rest.ApiException(
767
732
  status=0,
768
- reason=(
769
- "Failed to parse `{0}` as datetime object"
770
- .format(string)
771
- )
733
+ reason=("Failed to parse `{0}` as datetime object".format(string)),
772
734
  )
773
735
 
774
736
  def __deserialize_enum(self, data, klass):
@@ -782,11 +744,7 @@ class ApiClient:
782
744
  return klass(data)
783
745
  except ValueError:
784
746
  raise rest.ApiException(
785
- status=0,
786
- reason=(
787
- "Failed to parse `{0}` as `{1}`"
788
- .format(data, klass)
789
- )
747
+ status=0, reason=("Failed to parse `{0}` as `{1}`".format(data, klass))
790
748
  )
791
749
 
792
750
  def __deserialize_model(self, data, klass):
@@ -6,6 +6,7 @@ from pydantic import Field, StrictInt, StrictBytes, BaseModel
6
6
 
7
7
  T = TypeVar("T")
8
8
 
9
+
9
10
  class ApiResponse(BaseModel, Generic[T]):
10
11
  """
11
12
  API response object
@@ -16,6 +17,4 @@ class ApiResponse(BaseModel, Generic[T]):
16
17
  data: T = Field(description="Deserialized data given the data type")
17
18
  raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
18
19
 
19
- model_config = {
20
- "arbitrary_types_allowed": True
21
- }
20
+ model_config = {"arbitrary_types_allowed": True}