across-server-openapi-python 1.3.0__py3-none-any.whl → 2.0.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.
- across/sdk/v1/__init__.py +76 -17
- across/sdk/v1/api/__init__.py +3 -1
- across/sdk/v1/api/auth_api.py +17 -286
- across/sdk/v1/api/broker_alert_api.py +1017 -0
- across/sdk/v1/api/broker_event_api.py +697 -0
- across/sdk/v1/api/filter_api.py +20 -20
- across/sdk/v1/api/group_api.py +31 -281
- across/sdk/v1/api/group_invite_api.py +65 -66
- across/sdk/v1/api/group_role_api.py +105 -106
- across/sdk/v1/api/instrument_api.py +20 -20
- across/sdk/v1/api/internal_api.py +20 -21
- across/sdk/v1/api/observation_api.py +762 -135
- across/sdk/v1/api/observation_request_api.py +2108 -0
- across/sdk/v1/api/observatory_api.py +24 -25
- across/sdk/v1/api/permission_api.py +5 -6
- across/sdk/v1/api/role_api.py +1 -1
- across/sdk/v1/api/schedule_api.py +84 -86
- across/sdk/v1/api/service_account_api.py +125 -126
- across/sdk/v1/api/telescope_api.py +26 -26
- across/sdk/v1/api/tle_api.py +7 -8
- across/sdk/v1/api/tools_api.py +55 -55
- across/sdk/v1/api/user_api.py +84 -333
- across/sdk/v1/api_client.py +111 -47
- across/sdk/v1/configuration.py +106 -33
- across/sdk/v1/exceptions.py +8 -6
- across/sdk/v1/models/__init__.py +36 -9
- across/sdk/v1/models/access_token_response.py +5 -4
- across/sdk/v1/models/across_server_routes_v1_group_invite_schemas_group_invite.py +106 -0
- across/sdk/v1/models/across_server_routes_v1_group_role_schemas_group.py +93 -0
- across/sdk/v1/models/across_server_routes_v1_group_role_schemas_group_role.py +20 -15
- across/sdk/v1/models/across_server_routes_v1_group_role_schemas_service_account.py +107 -0
- across/sdk/v1/models/across_server_routes_v1_group_role_schemas_user.py +7 -5
- across/sdk/v1/models/across_server_routes_v1_group_schemas_group.py +12 -12
- across/sdk/v1/models/across_server_routes_v1_group_schemas_user.py +8 -7
- across/sdk/v1/models/across_server_routes_v1_role_schemas_user.py +95 -0
- across/sdk/v1/models/across_server_routes_v1_user_schemas_group.py +11 -10
- across/sdk/v1/models/across_server_routes_v1_user_schemas_group_invite.py +8 -6
- across/sdk/v1/models/across_server_routes_v1_user_schemas_group_role.py +106 -0
- across/sdk/v1/models/across_server_routes_v1_user_schemas_user.py +14 -16
- across/sdk/v1/models/across_server_routes_v1_user_service_account_schemas_service_account.py +8 -7
- across/sdk/v1/models/bandpass.py +1 -1
- across/sdk/v1/models/bandpass_type.py +1 -1
- across/sdk/v1/models/broker_alert.py +106 -0
- across/sdk/v1/models/broker_alert_create.py +115 -0
- across/sdk/v1/models/broker_alert_data_source.py +39 -0
- across/sdk/v1/models/broker_alert_status.py +41 -0
- across/sdk/v1/models/broker_event.py +115 -0
- across/sdk/v1/models/broker_event_type.py +41 -0
- across/sdk/v1/models/constrained_date.py +8 -6
- across/sdk/v1/models/constraint_reason.py +5 -4
- across/sdk/v1/models/constraint_type.py +1 -1
- across/sdk/v1/models/coordinate.py +5 -4
- across/sdk/v1/models/date_range.py +5 -4
- across/sdk/v1/models/date_range_create.py +96 -0
- across/sdk/v1/models/depth_unit.py +1 -1
- across/sdk/v1/models/energy_bandpass.py +5 -4
- across/sdk/v1/models/energy_unit.py +1 -1
- across/sdk/v1/models/ephemeris_type.py +1 -1
- across/sdk/v1/models/filter.py +8 -6
- across/sdk/v1/models/frequency_bandpass.py +5 -4
- across/sdk/v1/models/frequency_unit.py +1 -1
- across/sdk/v1/models/grant_type.py +1 -1
- across/sdk/v1/models/ground_parameters.py +5 -4
- across/sdk/v1/models/group.py +5 -15
- across/sdk/v1/models/group_base.py +93 -0
- across/sdk/v1/models/group_invite.py +1 -1
- across/sdk/v1/models/group_invite_create.py +5 -4
- across/sdk/v1/models/group_invite_group_details.py +7 -5
- across/sdk/v1/models/group_read.py +7 -5
- across/sdk/v1/models/group_role.py +37 -6
- across/sdk/v1/models/group_role_create.py +7 -5
- across/sdk/v1/models/group_role_read.py +16 -9
- across/sdk/v1/models/http_validation_error.py +6 -6
- across/sdk/v1/models/id_name_schema.py +7 -5
- across/sdk/v1/models/instrument.py +31 -15
- across/sdk/v1/models/ivoa_obs_category.py +1 -1
- across/sdk/v1/models/ivoa_obs_tracking_type.py +1 -1
- across/sdk/v1/models/joint_visibility_result.py +23 -23
- across/sdk/v1/models/jpl_parameters.py +5 -4
- across/sdk/v1/models/localization.py +128 -0
- across/sdk/v1/models/localization_contour_base.py +95 -0
- across/sdk/v1/models/localization_create.py +121 -0
- across/sdk/v1/models/location_inner.py +1 -1
- across/sdk/v1/models/name_resolver.py +5 -4
- across/sdk/v1/models/nullable_date_range.py +5 -4
- across/sdk/v1/models/nullable_end_date_range.py +96 -0
- across/sdk/v1/models/observation.py +11 -10
- across/sdk/v1/models/observation_create.py +9 -8
- across/sdk/v1/models/observation_footprint.py +10 -9
- across/sdk/v1/models/observation_footprint_create.py +6 -6
- across/sdk/v1/models/observation_request.py +202 -0
- across/sdk/v1/models/observation_request_create.py +148 -0
- across/sdk/v1/models/observation_request_create_many.py +95 -0
- across/sdk/v1/models/observation_request_status.py +40 -0
- across/sdk/v1/models/observation_request_update.py +213 -0
- across/sdk/v1/models/observation_request_version.py +99 -0
- across/sdk/v1/models/observation_status.py +1 -1
- across/sdk/v1/models/observation_strategy.py +1 -1
- across/sdk/v1/models/observation_type.py +1 -1
- across/sdk/v1/models/observation_window.py +134 -0
- across/sdk/v1/models/observation_window1.py +140 -0
- across/sdk/v1/models/observatory.py +9 -9
- across/sdk/v1/models/observatory_ephemeris_type.py +5 -4
- across/sdk/v1/models/observatory_type.py +1 -1
- across/sdk/v1/models/observing_proposal.py +93 -0
- across/sdk/v1/models/observing_proposal_create.py +98 -0
- across/sdk/v1/models/page_broker_alert.py +116 -0
- across/sdk/v1/models/page_broker_event.py +116 -0
- across/sdk/v1/models/page_observation.py +6 -6
- across/sdk/v1/models/page_observation_request.py +116 -0
- across/sdk/v1/models/page_schedule.py +6 -6
- across/sdk/v1/models/parameters.py +1 -1
- across/sdk/v1/models/permission.py +7 -5
- across/sdk/v1/models/point.py +5 -4
- across/sdk/v1/models/proper_motion.py +93 -0
- across/sdk/v1/models/role.py +4 -4
- across/sdk/v1/models/role_base.py +7 -5
- across/sdk/v1/models/schedule.py +10 -9
- across/sdk/v1/models/schedule_cadence.py +8 -6
- across/sdk/v1/models/schedule_create.py +8 -7
- across/sdk/v1/models/schedule_create_many.py +9 -8
- across/sdk/v1/models/schedule_fidelity.py +1 -1
- across/sdk/v1/models/schedule_status.py +1 -1
- across/sdk/v1/models/service_account.py +1 -1
- across/sdk/v1/models/service_account_create.py +5 -4
- across/sdk/v1/models/service_account_secret.py +7 -5
- across/sdk/v1/models/service_account_update.py +5 -4
- across/sdk/v1/models/setting.py +100 -0
- across/sdk/v1/models/setting_type.py +39 -0
- across/sdk/v1/models/spice_parameters.py +5 -4
- across/sdk/v1/models/system_service_account.py +9 -9
- across/sdk/v1/models/telescope.py +9 -9
- across/sdk/v1/models/telescope_instrument.py +31 -15
- across/sdk/v1/models/tle.py +5 -4
- across/sdk/v1/models/tle_create.py +5 -4
- across/sdk/v1/models/tle_parameters.py +5 -4
- across/sdk/v1/models/unit_value.py +5 -4
- across/sdk/v1/models/user.py +47 -7
- across/sdk/v1/models/user_create.py +5 -4
- across/sdk/v1/models/user_info.py +7 -5
- across/sdk/v1/models/user_update.py +5 -4
- across/sdk/v1/models/validation_error.py +21 -12
- across/sdk/v1/models/validation_error_loc_inner.py +1 -1
- across/sdk/v1/models/visibility_result.py +14 -11
- across/sdk/v1/models/visibility_type.py +1 -1
- across/sdk/v1/models/visibility_window.py +5 -4
- across/sdk/v1/models/wavelength_bandpass.py +5 -4
- across/sdk/v1/models/wavelength_unit.py +1 -1
- across/sdk/v1/models/window.py +5 -4
- across/sdk/v1/rest.py +88 -12
- {across_server_openapi_python-1.3.0.dist-info → across_server_openapi_python-2.0.0.dist-info}/METADATA +122 -45
- across_server_openapi_python-2.0.0.dist-info/RECORD +162 -0
- {across_server_openapi_python-1.3.0.dist-info → across_server_openapi_python-2.0.0.dist-info}/WHEEL +1 -1
- across_server_openapi_python-1.3.0.dist-info/RECORD +0 -126
- {across_server_openapi_python-1.3.0.dist-info → across_server_openapi_python-2.0.0.dist-info}/licenses/LICENSE +0 -0
- {across_server_openapi_python-1.3.0.dist-info → across_server_openapi_python-2.0.0.dist-info}/top_level.txt +0 -0
across/sdk/v1/api_client.py
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
1
|
"""
|
|
4
2
|
ACROSS Server
|
|
5
3
|
|
|
6
4
|
Server providing tools and utilities for various NASA missions to aid in coordination of large observation efforts.
|
|
7
5
|
|
|
8
|
-
The version of the OpenAPI document:
|
|
6
|
+
The version of the OpenAPI document: 2.0.2
|
|
9
7
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
8
|
|
|
11
9
|
Do not edit the class manually.
|
|
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,9 +20,10 @@ 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
|
-
from typing import Tuple, Optional, List, Dict, Union
|
|
26
|
+
from typing import Any, Tuple, Optional, List, Dict, Union
|
|
27
27
|
from pydantic import SecretStr
|
|
28
28
|
|
|
29
29
|
from across.sdk.v1.configuration import Configuration
|
|
@@ -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
|
|
@@ -102,15 +103,35 @@ class ApiClient:
|
|
|
102
103
|
@property
|
|
103
104
|
def user_agent(self):
|
|
104
105
|
"""User agent for this API client"""
|
|
105
|
-
|
|
106
|
+
for name, value in reversed(self.default_headers.items()):
|
|
107
|
+
if name.lower() == 'user-agent':
|
|
108
|
+
return value
|
|
109
|
+
raise KeyError('User-Agent')
|
|
106
110
|
|
|
107
111
|
@user_agent.setter
|
|
108
112
|
def user_agent(self, value):
|
|
109
|
-
self.default_headers
|
|
113
|
+
self._set_header(self.default_headers, 'User-Agent', value)
|
|
110
114
|
|
|
111
115
|
def set_default_header(self, header_name, header_value):
|
|
112
|
-
self.default_headers
|
|
116
|
+
self._set_header(self.default_headers, header_name, header_value)
|
|
117
|
+
|
|
113
118
|
|
|
119
|
+
@staticmethod
|
|
120
|
+
def _set_header(headers: Dict[str, Any], name: str, value: Any) -> None:
|
|
121
|
+
"""Replace a header case-insensitively, retaining the winning spelling."""
|
|
122
|
+
for key in list(headers):
|
|
123
|
+
if key.lower() == name.lower():
|
|
124
|
+
del headers[key]
|
|
125
|
+
headers[name] = value
|
|
126
|
+
|
|
127
|
+
@classmethod
|
|
128
|
+
def _merge_headers(cls, *sources: Optional[Dict[str, Any]]) -> Dict[str, Any]:
|
|
129
|
+
"""Copy headers; later sources and later entries in each dict win."""
|
|
130
|
+
headers: Dict[str, Any] = {}
|
|
131
|
+
for source in sources:
|
|
132
|
+
for name, value in (source or {}).items():
|
|
133
|
+
cls._set_header(headers, name, value)
|
|
134
|
+
return headers
|
|
114
135
|
|
|
115
136
|
_default = None
|
|
116
137
|
|
|
@@ -178,10 +199,9 @@ class ApiClient:
|
|
|
178
199
|
config = self.configuration
|
|
179
200
|
|
|
180
201
|
# header parameters
|
|
181
|
-
header_params = header_params
|
|
182
|
-
header_params.update(self.default_headers)
|
|
202
|
+
header_params = self._merge_headers(header_params, self.default_headers)
|
|
183
203
|
if self.cookie:
|
|
184
|
-
header_params
|
|
204
|
+
self._set_header(header_params, 'Cookie', self.cookie)
|
|
185
205
|
if header_params:
|
|
186
206
|
header_params = self.sanitize_for_serialization(header_params)
|
|
187
207
|
header_params = dict(
|
|
@@ -246,7 +266,6 @@ class ApiClient:
|
|
|
246
266
|
|
|
247
267
|
return method, url, header_params, body, post_params
|
|
248
268
|
|
|
249
|
-
|
|
250
269
|
def call_api(
|
|
251
270
|
self,
|
|
252
271
|
method,
|
|
@@ -301,17 +320,23 @@ class ApiClient:
|
|
|
301
320
|
# if not found, look for '1XX', '2XX', etc.
|
|
302
321
|
response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)
|
|
303
322
|
|
|
323
|
+
# If the response_type has not matched (eg. did not match the previous if statements) and the default response is available, use it.
|
|
324
|
+
if response_type is None and str(response_data.status) not in response_types_map \
|
|
325
|
+
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) \
|
|
326
|
+
and 'default' in response_types_map:
|
|
327
|
+
response_type = response_types_map['default']
|
|
328
|
+
|
|
304
329
|
# deserialize response data
|
|
305
330
|
response_text = None
|
|
306
331
|
return_data = None
|
|
307
332
|
try:
|
|
308
|
-
if response_type
|
|
333
|
+
if response_type in ("bytearray", "bytes"):
|
|
309
334
|
return_data = response_data.data
|
|
310
335
|
elif response_type == "file":
|
|
311
336
|
return_data = self.__deserialize_file(response_data)
|
|
312
337
|
elif response_type is not None:
|
|
313
338
|
match = None
|
|
314
|
-
content_type = response_data.
|
|
339
|
+
content_type = response_data.headers.get('content-type')
|
|
315
340
|
if content_type is not None:
|
|
316
341
|
match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
|
|
317
342
|
encoding = match.group(1) if match else "utf-8"
|
|
@@ -328,7 +353,7 @@ class ApiClient:
|
|
|
328
353
|
return ApiResponse(
|
|
329
354
|
status_code = response_data.status,
|
|
330
355
|
data = return_data,
|
|
331
|
-
headers = response_data.
|
|
356
|
+
headers = response_data.headers,
|
|
332
357
|
raw_data = response_data.data
|
|
333
358
|
)
|
|
334
359
|
|
|
@@ -356,6 +381,8 @@ class ApiClient:
|
|
|
356
381
|
return obj.get_secret_value()
|
|
357
382
|
elif isinstance(obj, self.PRIMITIVE_TYPES):
|
|
358
383
|
return obj
|
|
384
|
+
elif isinstance(obj, uuid.UUID):
|
|
385
|
+
return str(obj)
|
|
359
386
|
elif isinstance(obj, list):
|
|
360
387
|
return [
|
|
361
388
|
self.sanitize_for_serialization(sub_obj) for sub_obj in obj
|
|
@@ -368,28 +395,24 @@ class ApiClient:
|
|
|
368
395
|
return obj.isoformat()
|
|
369
396
|
elif isinstance(obj, decimal.Decimal):
|
|
370
397
|
return str(obj)
|
|
371
|
-
|
|
372
398
|
elif isinstance(obj, dict):
|
|
373
|
-
|
|
399
|
+
return {
|
|
400
|
+
key: self.sanitize_for_serialization(val)
|
|
401
|
+
for key, val in obj.items()
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
# Convert model obj to dict except
|
|
405
|
+
# attributes `openapi_types`, `attribute_map`
|
|
406
|
+
# and attributes which value is not None.
|
|
407
|
+
# Convert attribute name to json key in
|
|
408
|
+
# model definition for request.
|
|
409
|
+
if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
|
|
410
|
+
obj_dict = obj.to_dict()
|
|
374
411
|
else:
|
|
375
|
-
|
|
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__
|
|
412
|
+
obj_dict = obj.__dict__
|
|
384
413
|
|
|
385
|
-
|
|
386
|
-
# here we handle instances that can either be a list or something else, and only became a real list by calling to_dict()
|
|
387
|
-
return self.sanitize_for_serialization(obj_dict)
|
|
414
|
+
return self.sanitize_for_serialization(obj_dict)
|
|
388
415
|
|
|
389
|
-
return {
|
|
390
|
-
key: self.sanitize_for_serialization(val)
|
|
391
|
-
for key, val in obj_dict.items()
|
|
392
|
-
}
|
|
393
416
|
|
|
394
417
|
def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
|
|
395
418
|
"""Deserializes response into an object.
|
|
@@ -408,7 +431,7 @@ class ApiClient:
|
|
|
408
431
|
data = json.loads(response_text)
|
|
409
432
|
except ValueError:
|
|
410
433
|
data = response_text
|
|
411
|
-
elif re.match(r'^application/(json|[\w
|
|
434
|
+
elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
|
|
412
435
|
if response_text == "":
|
|
413
436
|
data = ""
|
|
414
437
|
else:
|
|
@@ -435,6 +458,12 @@ class ApiClient:
|
|
|
435
458
|
return None
|
|
436
459
|
|
|
437
460
|
if isinstance(klass, str):
|
|
461
|
+
if klass.startswith('Optional['):
|
|
462
|
+
m = re.match(r'Optional\[(.*)]', klass)
|
|
463
|
+
assert m is not None, "Malformed Optional type definition"
|
|
464
|
+
# data is not None here, so the optionality is already resolved
|
|
465
|
+
return self.__deserialize(data, m.group(1))
|
|
466
|
+
|
|
438
467
|
if klass.startswith('List['):
|
|
439
468
|
m = re.match(r'List\[(.*)]', klass)
|
|
440
469
|
assert m is not None, "Malformed List type definition"
|
|
@@ -457,14 +486,16 @@ class ApiClient:
|
|
|
457
486
|
|
|
458
487
|
if klass in self.PRIMITIVE_TYPES:
|
|
459
488
|
return self.__deserialize_primitive(data, klass)
|
|
460
|
-
elif klass
|
|
489
|
+
elif klass is object:
|
|
461
490
|
return self.__deserialize_object(data)
|
|
462
|
-
elif klass
|
|
491
|
+
elif klass is datetime.date:
|
|
463
492
|
return self.__deserialize_date(data)
|
|
464
|
-
elif klass
|
|
493
|
+
elif klass is datetime.datetime:
|
|
465
494
|
return self.__deserialize_datetime(data)
|
|
466
|
-
elif klass
|
|
495
|
+
elif klass is decimal.Decimal:
|
|
467
496
|
return decimal.Decimal(data)
|
|
497
|
+
elif klass is uuid.UUID:
|
|
498
|
+
return uuid.UUID(data)
|
|
468
499
|
elif issubclass(klass, Enum):
|
|
469
500
|
return self.__deserialize_enum(data, klass)
|
|
470
501
|
else:
|
|
@@ -481,10 +512,15 @@ class ApiClient:
|
|
|
481
512
|
if collection_formats is None:
|
|
482
513
|
collection_formats = {}
|
|
483
514
|
for k, v in params.items() if isinstance(params, dict) else params:
|
|
515
|
+
if isinstance(v, bool):
|
|
516
|
+
v = str(v).lower()
|
|
484
517
|
if k in collection_formats:
|
|
485
518
|
collection_format = collection_formats[k]
|
|
486
519
|
if collection_format == 'multi':
|
|
487
|
-
new_params.extend(
|
|
520
|
+
new_params.extend(
|
|
521
|
+
(k, str(value).lower() if isinstance(value, bool) else value)
|
|
522
|
+
for value in v
|
|
523
|
+
)
|
|
488
524
|
else:
|
|
489
525
|
if collection_format == 'ssv':
|
|
490
526
|
delimiter = ' '
|
|
@@ -495,11 +531,20 @@ class ApiClient:
|
|
|
495
531
|
else: # csv is the default
|
|
496
532
|
delimiter = ','
|
|
497
533
|
new_params.append(
|
|
498
|
-
(k, delimiter.join(
|
|
534
|
+
(k, delimiter.join(
|
|
535
|
+
str(value).lower() if isinstance(value, bool) else str(value)
|
|
536
|
+
for value in v)))
|
|
499
537
|
else:
|
|
500
538
|
new_params.append((k, v))
|
|
501
539
|
return new_params
|
|
502
540
|
|
|
541
|
+
def explode_query_object(self, name, obj):
|
|
542
|
+
"""form style, explode: one query parameter per entry, keyed by the property name; a list repeats the name, None is left out"""
|
|
543
|
+
obj = self.sanitize_for_serialization(obj)
|
|
544
|
+
if not isinstance(obj, dict):
|
|
545
|
+
obj = {name: obj}
|
|
546
|
+
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]
|
|
547
|
+
|
|
503
548
|
def parameters_to_url_query(self, params, collection_formats):
|
|
504
549
|
"""Get parameters as list of tuples, formatting collections.
|
|
505
550
|
|
|
@@ -518,10 +563,14 @@ class ApiClient:
|
|
|
518
563
|
if isinstance(v, dict):
|
|
519
564
|
v = json.dumps(v)
|
|
520
565
|
|
|
521
|
-
|
|
566
|
+
# a collection format applies only to a list; an exploded entry may share a declared array parameter's name
|
|
567
|
+
if k in collection_formats and isinstance(v, (list, tuple)):
|
|
522
568
|
collection_format = collection_formats[k]
|
|
523
569
|
if collection_format == 'multi':
|
|
524
|
-
new_params.extend(
|
|
570
|
+
new_params.extend(
|
|
571
|
+
(quote(str(k)), quote(str(value).lower() if isinstance(value, bool) else str(value)))
|
|
572
|
+
for value in v
|
|
573
|
+
)
|
|
525
574
|
else:
|
|
526
575
|
if collection_format == 'ssv':
|
|
527
576
|
delimiter = ' '
|
|
@@ -532,10 +581,13 @@ class ApiClient:
|
|
|
532
581
|
else: # csv is the default
|
|
533
582
|
delimiter = ','
|
|
534
583
|
new_params.append(
|
|
535
|
-
(k, delimiter.join(
|
|
584
|
+
(quote(str(k)), delimiter.join(
|
|
585
|
+
quote(str(value).lower() if isinstance(value, bool) else str(value))
|
|
586
|
+
for value in v))
|
|
536
587
|
)
|
|
537
588
|
else:
|
|
538
|
-
|
|
589
|
+
# names are quoted too: an exploded object's names are runtime data
|
|
590
|
+
new_params.append((quote(str(k)), quote(str(v))))
|
|
539
591
|
|
|
540
592
|
return "&".join(["=".join(map(str, item)) for item in new_params])
|
|
541
593
|
|
|
@@ -671,10 +723,20 @@ class ApiClient:
|
|
|
671
723
|
:param auth_setting: auth settings for the endpoint
|
|
672
724
|
"""
|
|
673
725
|
if auth_setting['in'] == 'cookie':
|
|
674
|
-
|
|
726
|
+
for key in list(headers):
|
|
727
|
+
if key.lower() == 'cookie':
|
|
728
|
+
self._set_header(headers, 'Cookie', headers[key])
|
|
729
|
+
break
|
|
730
|
+
if not headers.get('Cookie'):
|
|
731
|
+
headers['Cookie'] = ""
|
|
732
|
+
else:
|
|
733
|
+
headers['Cookie'] += "; "
|
|
734
|
+
# Account for cookie value containing spaces and special characters, excluding base64 delimiters
|
|
735
|
+
cookie_value = quote(str(auth_setting['value']), safe="!#$%&'()*+-./:<=>?@[]^_`{|}~%+/=")
|
|
736
|
+
headers['Cookie'] += f"{auth_setting['key']}={cookie_value}"
|
|
675
737
|
elif auth_setting['in'] == 'header':
|
|
676
738
|
if auth_setting['type'] != 'http-signature':
|
|
677
|
-
headers
|
|
739
|
+
self._set_header(headers, auth_setting['key'], auth_setting['value'])
|
|
678
740
|
elif auth_setting['in'] == 'query':
|
|
679
741
|
queries.append((auth_setting['key'], auth_setting['value']))
|
|
680
742
|
else:
|
|
@@ -698,14 +760,16 @@ class ApiClient:
|
|
|
698
760
|
os.close(fd)
|
|
699
761
|
os.remove(path)
|
|
700
762
|
|
|
701
|
-
content_disposition = response.
|
|
763
|
+
content_disposition = response.headers.get("Content-Disposition")
|
|
702
764
|
if content_disposition:
|
|
703
765
|
m = re.search(
|
|
704
766
|
r'filename=[\'"]?([^\'"\s]+)[\'"]?',
|
|
705
767
|
content_disposition
|
|
706
768
|
)
|
|
707
769
|
assert m is not None, "Unexpected 'content-disposition' header value"
|
|
708
|
-
filename = m.group(1)
|
|
770
|
+
filename = os.path.basename(m.group(1)) # Strip any directory traversal
|
|
771
|
+
if filename in ("", ".", ".."): # fall back to tmp filename
|
|
772
|
+
filename = os.path.basename(path)
|
|
709
773
|
path = os.path.join(os.path.dirname(path), filename)
|
|
710
774
|
|
|
711
775
|
with open(path, "wb") as f:
|
across/sdk/v1/configuration.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
1
|
"""
|
|
4
2
|
ACROSS Server
|
|
5
3
|
|
|
6
4
|
Server providing tools and utilities for various NASA missions to aid in coordination of large observation efforts.
|
|
7
5
|
|
|
8
|
-
The version of the OpenAPI document:
|
|
6
|
+
The version of the OpenAPI document: 2.0.2
|
|
9
7
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
8
|
|
|
11
9
|
Do not edit the class manually.
|
|
@@ -17,8 +15,11 @@ import http.client as httplib
|
|
|
17
15
|
import logging
|
|
18
16
|
from logging import FileHandler
|
|
19
17
|
import multiprocessing
|
|
18
|
+
import ssl
|
|
20
19
|
import sys
|
|
21
20
|
from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union
|
|
21
|
+
from urllib.parse import urlparse
|
|
22
|
+
from urllib.request import getproxies
|
|
22
23
|
from typing_extensions import NotRequired, Self
|
|
23
24
|
|
|
24
25
|
import urllib3
|
|
@@ -159,11 +160,27 @@ class Configuration:
|
|
|
159
160
|
string values to replace variables in templated server configuration.
|
|
160
161
|
The validation of enums is performed for variables with defined enum
|
|
161
162
|
values before.
|
|
163
|
+
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
|
|
164
|
+
when calling API from https server.
|
|
162
165
|
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
|
163
166
|
in PEM format.
|
|
164
|
-
:param retries:
|
|
167
|
+
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
|
|
165
168
|
:param ca_cert_data: verify the peer using concatenated CA certificate data
|
|
166
169
|
in PEM (str) or DER (bytes) format.
|
|
170
|
+
:param cert_file: the path to a client certificate file, for mTLS.
|
|
171
|
+
:param key_file: the path to a client key file, for mTLS.
|
|
172
|
+
:param assert_hostname: Set this to True/False to enable/disable SSL hostname verification.
|
|
173
|
+
:param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server.
|
|
174
|
+
:param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync.
|
|
175
|
+
:param proxy: Proxy URL.
|
|
176
|
+
:param no_proxy: Comma-separated hosts that bypass the proxy.
|
|
177
|
+
:param proxy_headers: Proxy headers.
|
|
178
|
+
:param proxy_ssl_context: SSL context used only for the TLS handshake with the proxy itself, independent of the destination TLS settings.
|
|
179
|
+
:param safe_chars_for_path_param: Safe characters for path parameter encoding.
|
|
180
|
+
:param client_side_validation: Enable client-side validation. Default True.
|
|
181
|
+
:param socket_options: Options to pass down to the underlying urllib3 socket.
|
|
182
|
+
:param datetime_format: Datetime format string for serialization.
|
|
183
|
+
:param date_format: Date format string for serialization.
|
|
167
184
|
|
|
168
185
|
:Example:
|
|
169
186
|
|
|
@@ -200,14 +217,29 @@ conf = across.sdk.v1.Configuration(
|
|
|
200
217
|
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
|
|
201
218
|
ignore_operation_servers: bool=False,
|
|
202
219
|
ssl_ca_cert: Optional[str]=None,
|
|
203
|
-
retries: Optional[int] = None,
|
|
220
|
+
retries: Optional[Union[int, urllib3.util.retry.Retry]] = None,
|
|
204
221
|
ca_cert_data: Optional[Union[str, bytes]] = None,
|
|
222
|
+
cert_file: Optional[str]=None,
|
|
223
|
+
key_file: Optional[str]=None,
|
|
224
|
+
verify_ssl: bool=True,
|
|
225
|
+
assert_hostname: Optional[bool]=None,
|
|
226
|
+
tls_server_name: Optional[str]=None,
|
|
227
|
+
connection_pool_maxsize: Optional[int]=None,
|
|
228
|
+
proxy: Optional[str]=None,
|
|
229
|
+
no_proxy: Optional[str]=None,
|
|
230
|
+
proxy_headers: Optional[Any]=None,
|
|
231
|
+
proxy_ssl_context: Optional[ssl.SSLContext]=None,
|
|
232
|
+
safe_chars_for_path_param: str='',
|
|
233
|
+
client_side_validation: bool=True,
|
|
234
|
+
socket_options: Optional[Any]=None,
|
|
235
|
+
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
|
|
236
|
+
date_format: str="%Y-%m-%d",
|
|
205
237
|
*,
|
|
206
238
|
debug: Optional[bool] = None,
|
|
207
239
|
) -> None:
|
|
208
240
|
"""Constructor
|
|
209
241
|
"""
|
|
210
|
-
self._base_path = "/api/v1" if host is None else host
|
|
242
|
+
self._base_path = "/across/api/v1" if host is None else host
|
|
211
243
|
"""Default Base url
|
|
212
244
|
"""
|
|
213
245
|
self.server_index = 0 if server_index is None and host is None else server_index
|
|
@@ -271,7 +303,7 @@ conf = across.sdk.v1.Configuration(
|
|
|
271
303
|
"""Debug switch
|
|
272
304
|
"""
|
|
273
305
|
|
|
274
|
-
self.verify_ssl =
|
|
306
|
+
self.verify_ssl = verify_ssl
|
|
275
307
|
"""SSL/TLS verification
|
|
276
308
|
Set this to false to skip verifying SSL certificate when calling API
|
|
277
309
|
from https server.
|
|
@@ -283,52 +315,66 @@ conf = across.sdk.v1.Configuration(
|
|
|
283
315
|
"""Set this to verify the peer using PEM (str) or DER (bytes)
|
|
284
316
|
certificate data.
|
|
285
317
|
"""
|
|
286
|
-
self.cert_file =
|
|
318
|
+
self.cert_file = cert_file
|
|
287
319
|
"""client certificate file
|
|
288
320
|
"""
|
|
289
|
-
self.key_file =
|
|
321
|
+
self.key_file = key_file
|
|
290
322
|
"""client key file
|
|
291
323
|
"""
|
|
292
|
-
self.assert_hostname =
|
|
324
|
+
self.assert_hostname = assert_hostname
|
|
293
325
|
"""Set this to True/False to enable/disable SSL hostname verification.
|
|
294
326
|
"""
|
|
295
|
-
self.tls_server_name =
|
|
327
|
+
self.tls_server_name = tls_server_name
|
|
296
328
|
"""SSL/TLS Server Name Indication (SNI)
|
|
297
329
|
Set this to the SNI value expected by the server.
|
|
298
330
|
"""
|
|
299
331
|
|
|
300
|
-
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
|
|
332
|
+
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
|
|
301
333
|
"""urllib3 connection pool's maximum number of connections saved
|
|
302
|
-
per pool.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
334
|
+
per pool. None in the constructor is coerced to cpu_count * 5.
|
|
335
|
+
"""
|
|
336
|
+
|
|
337
|
+
# urllib3 does not read proxy environment variables itself:
|
|
338
|
+
# https://github.com/urllib3/urllib3/issues/1785
|
|
339
|
+
# A proxy taken from the environment is re-resolved when the host is
|
|
340
|
+
# assigned; see the host setter.
|
|
341
|
+
self._proxy_from_env = proxy is None
|
|
342
|
+
if proxy is None or no_proxy is None:
|
|
343
|
+
proxies = getproxies()
|
|
344
|
+
if proxy is None:
|
|
345
|
+
proxy = self._env_proxy(proxies, self.host)
|
|
346
|
+
if no_proxy is None:
|
|
347
|
+
no_proxy = proxies.get("no")
|
|
348
|
+
self._proxy = proxy
|
|
349
|
+
self.no_proxy = no_proxy
|
|
350
|
+
"""Hosts that bypass the proxy
|
|
351
|
+
"""
|
|
352
|
+
self.proxy_headers = proxy_headers
|
|
312
353
|
"""Proxy headers
|
|
313
354
|
"""
|
|
314
|
-
self.
|
|
355
|
+
self.proxy_ssl_context = proxy_ssl_context
|
|
356
|
+
"""SSL context used only for the TLS handshake with the proxy itself
|
|
357
|
+
(e.g. an HTTPS CONNECT tunnel), independent of the destination TLS
|
|
358
|
+
settings above.
|
|
359
|
+
"""
|
|
360
|
+
self.safe_chars_for_path_param = safe_chars_for_path_param
|
|
315
361
|
"""Safe chars for path_param
|
|
316
362
|
"""
|
|
317
363
|
self.retries = retries
|
|
318
|
-
"""
|
|
364
|
+
"""Retry configuration
|
|
319
365
|
"""
|
|
320
366
|
# Enable client side validation
|
|
321
|
-
self.client_side_validation =
|
|
367
|
+
self.client_side_validation = client_side_validation
|
|
322
368
|
|
|
323
|
-
self.socket_options =
|
|
369
|
+
self.socket_options = socket_options
|
|
324
370
|
"""Options to pass down to the underlying urllib3 socket
|
|
325
371
|
"""
|
|
326
372
|
|
|
327
|
-
self.datetime_format =
|
|
373
|
+
self.datetime_format = datetime_format
|
|
328
374
|
"""datetime format
|
|
329
375
|
"""
|
|
330
376
|
|
|
331
|
-
self.date_format =
|
|
377
|
+
self.date_format = date_format
|
|
332
378
|
"""date format
|
|
333
379
|
"""
|
|
334
380
|
|
|
@@ -337,13 +383,17 @@ conf = across.sdk.v1.Configuration(
|
|
|
337
383
|
result = cls.__new__(cls)
|
|
338
384
|
memo[id(self)] = result
|
|
339
385
|
for k, v in self.__dict__.items():
|
|
386
|
+
if k == 'proxy_ssl_context':
|
|
387
|
+
# ssl.SSLContext holds unpicklable C state and can't be deepcopied.
|
|
388
|
+
setattr(result, k, v)
|
|
389
|
+
continue
|
|
340
390
|
if k not in ('logger', 'logger_file_handler'):
|
|
341
391
|
setattr(result, k, copy.deepcopy(v, memo))
|
|
342
392
|
# shallow copy of loggers
|
|
343
393
|
result.logger = copy.copy(self.logger)
|
|
344
|
-
# use
|
|
394
|
+
# use setter to re-create the file handler (excluded from __dict__ copy)
|
|
345
395
|
result.logger_file = self.logger_file
|
|
346
|
-
|
|
396
|
+
|
|
347
397
|
return result
|
|
348
398
|
|
|
349
399
|
def __setattr__(self, name: str, value: Any) -> None:
|
|
@@ -480,7 +530,8 @@ conf = across.sdk.v1.Configuration(
|
|
|
480
530
|
self.refresh_api_key_hook(self)
|
|
481
531
|
key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
|
|
482
532
|
if key:
|
|
483
|
-
prefix = self.api_key_prefix.get(
|
|
533
|
+
prefix = self.api_key_prefix.get(
|
|
534
|
+
identifier, self.api_key_prefix.get(alias) if alias is not None else None)
|
|
484
535
|
if prefix:
|
|
485
536
|
return "%s %s" % (prefix, key)
|
|
486
537
|
else:
|
|
@@ -499,6 +550,7 @@ conf = across.sdk.v1.Configuration(
|
|
|
499
550
|
password = ""
|
|
500
551
|
if self.password is not None:
|
|
501
552
|
password = self.password
|
|
553
|
+
|
|
502
554
|
return urllib3.util.make_headers(
|
|
503
555
|
basic_auth=username + ':' + password
|
|
504
556
|
).get('authorization')
|
|
@@ -533,7 +585,7 @@ conf = across.sdk.v1.Configuration(
|
|
|
533
585
|
return "Python SDK Debug Report:\n"\
|
|
534
586
|
"OS: {env}\n"\
|
|
535
587
|
"Python Version: {pyversion}\n"\
|
|
536
|
-
"Version of the API:
|
|
588
|
+
"Version of the API: 2.0.2\n"\
|
|
537
589
|
"SDK Package Version: 1.0.0".\
|
|
538
590
|
format(env=sys.platform, pyversion=sys.version)
|
|
539
591
|
|
|
@@ -544,7 +596,7 @@ conf = across.sdk.v1.Configuration(
|
|
|
544
596
|
"""
|
|
545
597
|
return [
|
|
546
598
|
{
|
|
547
|
-
'url': "/api/v1",
|
|
599
|
+
'url': "/across/api/v1",
|
|
548
600
|
'description': "No description provided",
|
|
549
601
|
}
|
|
550
602
|
]
|
|
@@ -582,6 +634,7 @@ conf = across.sdk.v1.Configuration(
|
|
|
582
634
|
variable_name, variable['default_value'])
|
|
583
635
|
|
|
584
636
|
if 'enum_values' in variable \
|
|
637
|
+
and variable['enum_values'] \
|
|
585
638
|
and used_value not in variable['enum_values']:
|
|
586
639
|
raise ValueError(
|
|
587
640
|
"The variable `{0}` in the host URL has invalid value "
|
|
@@ -603,3 +656,23 @@ conf = across.sdk.v1.Configuration(
|
|
|
603
656
|
"""Fix base path."""
|
|
604
657
|
self._base_path = value
|
|
605
658
|
self.server_index = None
|
|
659
|
+
if self._proxy_from_env:
|
|
660
|
+
# the scheme-specific proxy depends on the host, which is
|
|
661
|
+
# commonly assigned after construction
|
|
662
|
+
self._proxy = self._env_proxy(getproxies(), value)
|
|
663
|
+
|
|
664
|
+
@staticmethod
|
|
665
|
+
def _env_proxy(proxies: Dict[str, str], host: str) -> Optional[str]:
|
|
666
|
+
"""Pick the environment proxy that applies to `host`."""
|
|
667
|
+
return proxies.get(urlparse(host).scheme) or proxies.get("all")
|
|
668
|
+
|
|
669
|
+
@property
|
|
670
|
+
def proxy(self) -> Optional[str]:
|
|
671
|
+
"""Proxy URL
|
|
672
|
+
"""
|
|
673
|
+
return self._proxy
|
|
674
|
+
|
|
675
|
+
@proxy.setter
|
|
676
|
+
def proxy(self, value: Optional[str]) -> None:
|
|
677
|
+
self._proxy = value
|
|
678
|
+
self._proxy_from_env = False
|
across/sdk/v1/exceptions.py
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
1
|
"""
|
|
4
2
|
ACROSS Server
|
|
5
3
|
|
|
6
4
|
Server providing tools and utilities for various NASA missions to aid in coordination of large observation efforts.
|
|
7
5
|
|
|
8
|
-
The version of the OpenAPI document:
|
|
6
|
+
The version of the OpenAPI document: 2.0.2
|
|
9
7
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
8
|
|
|
11
9
|
Do not edit the class manually.
|
|
12
10
|
""" # noqa: E501
|
|
13
11
|
|
|
12
|
+
|
|
14
13
|
from typing import Any, Optional
|
|
15
14
|
from typing_extensions import Self
|
|
16
15
|
|
|
@@ -128,7 +127,7 @@ class ApiException(OpenApiException):
|
|
|
128
127
|
self.body = http_resp.data.decode('utf-8')
|
|
129
128
|
except Exception:
|
|
130
129
|
pass
|
|
131
|
-
self.headers = http_resp.
|
|
130
|
+
self.headers = http_resp.headers
|
|
132
131
|
|
|
133
132
|
@classmethod
|
|
134
133
|
def from_response(
|
|
@@ -169,8 +168,11 @@ class ApiException(OpenApiException):
|
|
|
169
168
|
error_message += "HTTP response headers: {0}\n".format(
|
|
170
169
|
self.headers)
|
|
171
170
|
|
|
172
|
-
if self.
|
|
173
|
-
error_message += "HTTP response body: {0}\n".format(self.
|
|
171
|
+
if self.body:
|
|
172
|
+
error_message += "HTTP response body: {0}\n".format(self.body)
|
|
173
|
+
|
|
174
|
+
if self.data:
|
|
175
|
+
error_message += "HTTP response data: {0}\n".format(self.data)
|
|
174
176
|
|
|
175
177
|
return error_message
|
|
176
178
|
|