fds.sdk.VectorData 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fds/__init__.py +0 -0
- fds/sdk/VectorData/__init__.py +28 -0
- fds/sdk/VectorData/api/__init__.py +3 -0
- fds/sdk/VectorData/api/meta_api.py +959 -0
- fds/sdk/VectorData/api/vector_api.py +564 -0
- fds/sdk/VectorData/api_client.py +939 -0
- fds/sdk/VectorData/apis/__init__.py +18 -0
- fds/sdk/VectorData/configuration.py +496 -0
- fds/sdk/VectorData/exceptions.py +160 -0
- fds/sdk/VectorData/model/__init__.py +5 -0
- fds/sdk/VectorData/model/chunk_text_response.py +268 -0
- fds/sdk/VectorData/model/chunk_text_response_meta.py +262 -0
- fds/sdk/VectorData/model/chunk_text_response_meta_pagination.py +260 -0
- fds/sdk/VectorData/model/chunk_text_result.py +284 -0
- fds/sdk/VectorData/model/document_types.py +268 -0
- fds/sdk/VectorData/model/document_types_response.py +262 -0
- fds/sdk/VectorData/model/error_object.py +268 -0
- fds/sdk/VectorData/model/error_response.py +262 -0
- fds/sdk/VectorData/model/meta.py +260 -0
- fds/sdk/VectorData/model/schemas.py +274 -0
- fds/sdk/VectorData/model/schemas_response.py +262 -0
- fds/sdk/VectorData/model/source.py +268 -0
- fds/sdk/VectorData/model/source_response.py +262 -0
- fds/sdk/VectorData/model/themes.py +274 -0
- fds/sdk/VectorData/model/themes_response.py +262 -0
- fds/sdk/VectorData/model/vector_data_request.py +274 -0
- fds/sdk/VectorData/model/vector_data_request_data.py +313 -0
- fds/sdk/VectorData/model/vector_data_response.py +268 -0
- fds/sdk/VectorData/model/vector_data_response_meta.py +256 -0
- fds/sdk/VectorData/model/vector_data_result.py +296 -0
- fds/sdk/VectorData/model_utils.py +2062 -0
- fds/sdk/VectorData/models/__init__.py +31 -0
- fds/sdk/VectorData/rest.py +347 -0
- fds/sdk/__init__.py +0 -0
- fds_sdk_vectordata-0.0.1.dist-info/METADATA +349 -0
- fds_sdk_vectordata-0.0.1.dist-info/RECORD +39 -0
- fds_sdk_vectordata-0.0.1.dist-info/WHEEL +5 -0
- fds_sdk_vectordata-0.0.1.dist-info/licenses/LICENSE +202 -0
- fds_sdk_vectordata-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# flake8: noqa
|
|
2
|
+
|
|
3
|
+
# import all models into this package
|
|
4
|
+
# if you have many models here with many references from one model to another this may
|
|
5
|
+
# raise a RecursionError
|
|
6
|
+
# to avoid this, import only the models that you directly need like:
|
|
7
|
+
# from from fds.sdk.VectorData.model.pet import Pet
|
|
8
|
+
# or import this package, but before doing it, use:
|
|
9
|
+
# import sys
|
|
10
|
+
# sys.setrecursionlimit(n)
|
|
11
|
+
|
|
12
|
+
from fds.sdk.VectorData.model.chunk_text_response import ChunkTextResponse
|
|
13
|
+
from fds.sdk.VectorData.model.chunk_text_response_meta import ChunkTextResponseMeta
|
|
14
|
+
from fds.sdk.VectorData.model.chunk_text_response_meta_pagination import ChunkTextResponseMetaPagination
|
|
15
|
+
from fds.sdk.VectorData.model.chunk_text_result import ChunkTextResult
|
|
16
|
+
from fds.sdk.VectorData.model.document_types import DocumentTypes
|
|
17
|
+
from fds.sdk.VectorData.model.document_types_response import DocumentTypesResponse
|
|
18
|
+
from fds.sdk.VectorData.model.error_object import ErrorObject
|
|
19
|
+
from fds.sdk.VectorData.model.error_response import ErrorResponse
|
|
20
|
+
from fds.sdk.VectorData.model.meta import Meta
|
|
21
|
+
from fds.sdk.VectorData.model.schemas import Schemas
|
|
22
|
+
from fds.sdk.VectorData.model.schemas_response import SchemasResponse
|
|
23
|
+
from fds.sdk.VectorData.model.source import Source
|
|
24
|
+
from fds.sdk.VectorData.model.source_response import SourceResponse
|
|
25
|
+
from fds.sdk.VectorData.model.themes import Themes
|
|
26
|
+
from fds.sdk.VectorData.model.themes_response import ThemesResponse
|
|
27
|
+
from fds.sdk.VectorData.model.vector_data_request import VectorDataRequest
|
|
28
|
+
from fds.sdk.VectorData.model.vector_data_request_data import VectorDataRequestData
|
|
29
|
+
from fds.sdk.VectorData.model.vector_data_response import VectorDataResponse
|
|
30
|
+
from fds.sdk.VectorData.model.vector_data_response_meta import VectorDataResponseMeta
|
|
31
|
+
from fds.sdk.VectorData.model.vector_data_result import VectorDataResult
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Vector Data API
|
|
3
|
+
|
|
4
|
+
The Vector Data API provides streamlined access to vector data through its defined endpoints. It supports functionalities such as: Retrieving detailed vector data based on user-defined parameters. Efficiently processing associated text data for enhanced performance. This API is designed to enable developers to integrate vector data into their applications, ensuring flexibility and performance while leveraging the specified endpoint functionalities. # noqa: E501
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 0.0.0
|
|
7
|
+
Contact: api@factset.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
import io
|
|
13
|
+
import json
|
|
14
|
+
import logging
|
|
15
|
+
import re
|
|
16
|
+
import ssl
|
|
17
|
+
from urllib.parse import urlencode
|
|
18
|
+
from urllib.parse import urlparse
|
|
19
|
+
from urllib.request import proxy_bypass_environment
|
|
20
|
+
import urllib3
|
|
21
|
+
import ipaddress
|
|
22
|
+
|
|
23
|
+
from fds.sdk.VectorData.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
logger = logging.getLogger(__name__)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class RESTResponse(io.IOBase):
|
|
30
|
+
|
|
31
|
+
def __init__(self, resp):
|
|
32
|
+
self.urllib3_response = resp
|
|
33
|
+
self.status = resp.status
|
|
34
|
+
self.reason = resp.reason
|
|
35
|
+
self.data = resp.data
|
|
36
|
+
|
|
37
|
+
def getheaders(self):
|
|
38
|
+
"""Returns a dictionary of the response headers."""
|
|
39
|
+
return self.urllib3_response.headers
|
|
40
|
+
|
|
41
|
+
def getheader(self, name, default=None):
|
|
42
|
+
"""Returns a given response header."""
|
|
43
|
+
return self.urllib3_response.headers.get(name, default)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class RESTClientObject(object):
|
|
47
|
+
|
|
48
|
+
def __init__(self, configuration, pools_size=4, maxsize=None):
|
|
49
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
50
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
51
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
52
|
+
# maxsize is the number of requests to host that are allowed in parallel # noqa: E501
|
|
53
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
54
|
+
|
|
55
|
+
# cert_reqs
|
|
56
|
+
if configuration.verify_ssl:
|
|
57
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
58
|
+
else:
|
|
59
|
+
cert_reqs = ssl.CERT_NONE
|
|
60
|
+
|
|
61
|
+
addition_pool_args = {}
|
|
62
|
+
if configuration.assert_hostname is not None:
|
|
63
|
+
addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
|
|
64
|
+
|
|
65
|
+
if configuration.retries is not None:
|
|
66
|
+
addition_pool_args['retries'] = configuration.retries
|
|
67
|
+
|
|
68
|
+
if configuration.socket_options is not None:
|
|
69
|
+
addition_pool_args['socket_options'] = configuration.socket_options
|
|
70
|
+
|
|
71
|
+
if maxsize is None:
|
|
72
|
+
if configuration.connection_pool_maxsize is not None:
|
|
73
|
+
maxsize = configuration.connection_pool_maxsize
|
|
74
|
+
else:
|
|
75
|
+
maxsize = 4
|
|
76
|
+
|
|
77
|
+
# https pool manager
|
|
78
|
+
if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''):
|
|
79
|
+
self.pool_manager = urllib3.ProxyManager(
|
|
80
|
+
num_pools=pools_size,
|
|
81
|
+
maxsize=maxsize,
|
|
82
|
+
cert_reqs=cert_reqs,
|
|
83
|
+
ca_certs=configuration.ssl_ca_cert,
|
|
84
|
+
cert_file=configuration.cert_file,
|
|
85
|
+
key_file=configuration.key_file,
|
|
86
|
+
proxy_url=configuration.proxy,
|
|
87
|
+
proxy_headers=configuration.proxy_headers,
|
|
88
|
+
**addition_pool_args
|
|
89
|
+
)
|
|
90
|
+
else:
|
|
91
|
+
self.pool_manager = urllib3.PoolManager(
|
|
92
|
+
num_pools=pools_size,
|
|
93
|
+
maxsize=maxsize,
|
|
94
|
+
cert_reqs=cert_reqs,
|
|
95
|
+
ca_certs=configuration.ssl_ca_cert,
|
|
96
|
+
cert_file=configuration.cert_file,
|
|
97
|
+
key_file=configuration.key_file,
|
|
98
|
+
**addition_pool_args
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def request(self, method, url, query_params=None, headers=None,
|
|
102
|
+
body=None, post_params=None, _preload_content=True,
|
|
103
|
+
_request_timeout=None):
|
|
104
|
+
"""Perform requests.
|
|
105
|
+
|
|
106
|
+
:param method: http request method
|
|
107
|
+
:param url: http request url
|
|
108
|
+
:param query_params: query parameters in the url
|
|
109
|
+
:param headers: http request headers
|
|
110
|
+
:param body: request json body, for `application/json`
|
|
111
|
+
:param post_params: request post parameters,
|
|
112
|
+
`application/x-www-form-urlencoded`
|
|
113
|
+
and `multipart/form-data`
|
|
114
|
+
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
115
|
+
be returned without reading/decoding response
|
|
116
|
+
data. Default is True.
|
|
117
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
118
|
+
number provided, it will be total request
|
|
119
|
+
timeout. It can also be a pair (tuple) of
|
|
120
|
+
(connection, read) timeouts.
|
|
121
|
+
"""
|
|
122
|
+
method = method.upper()
|
|
123
|
+
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
|
|
124
|
+
'PATCH', 'OPTIONS']
|
|
125
|
+
|
|
126
|
+
if post_params and body:
|
|
127
|
+
raise ApiValueError(
|
|
128
|
+
"body parameter cannot be used with post_params parameter."
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
post_params = post_params or {}
|
|
132
|
+
headers = headers or {}
|
|
133
|
+
|
|
134
|
+
timeout = None
|
|
135
|
+
if _request_timeout:
|
|
136
|
+
if isinstance(_request_timeout, (int, float)): # noqa: E501,F821
|
|
137
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
138
|
+
elif (isinstance(_request_timeout, tuple) and
|
|
139
|
+
len(_request_timeout) == 2):
|
|
140
|
+
timeout = urllib3.Timeout(
|
|
141
|
+
connect=_request_timeout[0], read=_request_timeout[1])
|
|
142
|
+
|
|
143
|
+
try:
|
|
144
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
145
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
|
146
|
+
# Only set a default Content-Type for POST, PUT, PATCH and OPTIONS requests
|
|
147
|
+
if (method != 'DELETE') and ('Content-Type' not in headers):
|
|
148
|
+
headers['Content-Type'] = 'application/json'
|
|
149
|
+
if query_params:
|
|
150
|
+
url += '?' + urlencode(query_params)
|
|
151
|
+
if ('Content-Type' not in headers) or (re.search('json', headers['Content-Type'], re.IGNORECASE)):
|
|
152
|
+
request_body = None
|
|
153
|
+
if body is not None:
|
|
154
|
+
request_body = json.dumps(body)
|
|
155
|
+
r = self.pool_manager.request(
|
|
156
|
+
method, url,
|
|
157
|
+
body=request_body,
|
|
158
|
+
preload_content=_preload_content,
|
|
159
|
+
timeout=timeout,
|
|
160
|
+
headers=headers)
|
|
161
|
+
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
|
|
162
|
+
r = self.pool_manager.request(
|
|
163
|
+
method, url,
|
|
164
|
+
fields=post_params,
|
|
165
|
+
encode_multipart=False,
|
|
166
|
+
preload_content=_preload_content,
|
|
167
|
+
timeout=timeout,
|
|
168
|
+
headers=headers)
|
|
169
|
+
elif headers['Content-Type'] == 'multipart/form-data':
|
|
170
|
+
# must del headers['Content-Type'], or the correct
|
|
171
|
+
# Content-Type which generated by urllib3 will be
|
|
172
|
+
# overwritten.
|
|
173
|
+
del headers['Content-Type']
|
|
174
|
+
r = self.pool_manager.request(
|
|
175
|
+
method, url,
|
|
176
|
+
fields=post_params,
|
|
177
|
+
encode_multipart=True,
|
|
178
|
+
preload_content=_preload_content,
|
|
179
|
+
timeout=timeout,
|
|
180
|
+
headers=headers)
|
|
181
|
+
# Pass a `string` parameter directly in the body to support
|
|
182
|
+
# other content types than Json when `body` argument is
|
|
183
|
+
# provided in serialized form
|
|
184
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
185
|
+
request_body = body
|
|
186
|
+
r = self.pool_manager.request(
|
|
187
|
+
method, url,
|
|
188
|
+
body=request_body,
|
|
189
|
+
preload_content=_preload_content,
|
|
190
|
+
timeout=timeout,
|
|
191
|
+
headers=headers)
|
|
192
|
+
else:
|
|
193
|
+
# Cannot generate the request from given parameters
|
|
194
|
+
msg = """Cannot prepare a request message for provided
|
|
195
|
+
arguments. Please check that your arguments match
|
|
196
|
+
declared content type."""
|
|
197
|
+
raise ApiException(status=0, reason=msg)
|
|
198
|
+
# For `GET`, `HEAD`
|
|
199
|
+
else:
|
|
200
|
+
r = self.pool_manager.request(method, url,
|
|
201
|
+
fields=query_params,
|
|
202
|
+
preload_content=_preload_content,
|
|
203
|
+
timeout=timeout,
|
|
204
|
+
headers=headers)
|
|
205
|
+
except urllib3.exceptions.SSLError as e:
|
|
206
|
+
msg = "{0}\n{1}".format(type(e).__name__, str(e))
|
|
207
|
+
raise ApiException(status=0, reason=msg)
|
|
208
|
+
|
|
209
|
+
if _preload_content:
|
|
210
|
+
r = RESTResponse(r)
|
|
211
|
+
|
|
212
|
+
# log response body
|
|
213
|
+
logger.debug("response body: %s", r.data)
|
|
214
|
+
|
|
215
|
+
if not 200 <= r.status <= 299:
|
|
216
|
+
if r.status == 401:
|
|
217
|
+
raise UnauthorizedException(http_resp=r)
|
|
218
|
+
|
|
219
|
+
if r.status == 403:
|
|
220
|
+
raise ForbiddenException(http_resp=r)
|
|
221
|
+
|
|
222
|
+
if r.status == 404:
|
|
223
|
+
raise NotFoundException(http_resp=r)
|
|
224
|
+
|
|
225
|
+
if 500 <= r.status <= 599:
|
|
226
|
+
raise ServiceException(http_resp=r)
|
|
227
|
+
|
|
228
|
+
raise ApiException(http_resp=r)
|
|
229
|
+
|
|
230
|
+
return r
|
|
231
|
+
|
|
232
|
+
def GET(self, url, headers=None, query_params=None, _preload_content=True,
|
|
233
|
+
_request_timeout=None):
|
|
234
|
+
return self.request("GET", url,
|
|
235
|
+
headers=headers,
|
|
236
|
+
_preload_content=_preload_content,
|
|
237
|
+
_request_timeout=_request_timeout,
|
|
238
|
+
query_params=query_params)
|
|
239
|
+
|
|
240
|
+
def HEAD(self, url, headers=None, query_params=None, _preload_content=True,
|
|
241
|
+
_request_timeout=None):
|
|
242
|
+
return self.request("HEAD", url,
|
|
243
|
+
headers=headers,
|
|
244
|
+
_preload_content=_preload_content,
|
|
245
|
+
_request_timeout=_request_timeout,
|
|
246
|
+
query_params=query_params)
|
|
247
|
+
|
|
248
|
+
def OPTIONS(self, url, headers=None, query_params=None, post_params=None,
|
|
249
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
250
|
+
return self.request("OPTIONS", url,
|
|
251
|
+
headers=headers,
|
|
252
|
+
query_params=query_params,
|
|
253
|
+
post_params=post_params,
|
|
254
|
+
_preload_content=_preload_content,
|
|
255
|
+
_request_timeout=_request_timeout,
|
|
256
|
+
body=body)
|
|
257
|
+
|
|
258
|
+
def DELETE(self, url, headers=None, query_params=None, body=None,
|
|
259
|
+
_preload_content=True, _request_timeout=None):
|
|
260
|
+
return self.request("DELETE", url,
|
|
261
|
+
headers=headers,
|
|
262
|
+
query_params=query_params,
|
|
263
|
+
_preload_content=_preload_content,
|
|
264
|
+
_request_timeout=_request_timeout,
|
|
265
|
+
body=body)
|
|
266
|
+
|
|
267
|
+
def POST(self, url, headers=None, query_params=None, post_params=None,
|
|
268
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
269
|
+
return self.request("POST", url,
|
|
270
|
+
headers=headers,
|
|
271
|
+
query_params=query_params,
|
|
272
|
+
post_params=post_params,
|
|
273
|
+
_preload_content=_preload_content,
|
|
274
|
+
_request_timeout=_request_timeout,
|
|
275
|
+
body=body)
|
|
276
|
+
|
|
277
|
+
def PUT(self, url, headers=None, query_params=None, post_params=None,
|
|
278
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
279
|
+
return self.request("PUT", url,
|
|
280
|
+
headers=headers,
|
|
281
|
+
query_params=query_params,
|
|
282
|
+
post_params=post_params,
|
|
283
|
+
_preload_content=_preload_content,
|
|
284
|
+
_request_timeout=_request_timeout,
|
|
285
|
+
body=body)
|
|
286
|
+
|
|
287
|
+
def PATCH(self, url, headers=None, query_params=None, post_params=None,
|
|
288
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
289
|
+
return self.request("PATCH", url,
|
|
290
|
+
headers=headers,
|
|
291
|
+
query_params=query_params,
|
|
292
|
+
post_params=post_params,
|
|
293
|
+
_preload_content=_preload_content,
|
|
294
|
+
_request_timeout=_request_timeout,
|
|
295
|
+
body=body)
|
|
296
|
+
|
|
297
|
+
# end of class RESTClientObject
|
|
298
|
+
def is_ipv4(target):
|
|
299
|
+
""" Test if IPv4 address or not
|
|
300
|
+
"""
|
|
301
|
+
try:
|
|
302
|
+
chk = ipaddress.IPv4Address(target)
|
|
303
|
+
return True
|
|
304
|
+
except ipaddress.AddressValueError:
|
|
305
|
+
return False
|
|
306
|
+
|
|
307
|
+
def in_ipv4net(target, net):
|
|
308
|
+
""" Test if target belongs to given IPv4 network
|
|
309
|
+
"""
|
|
310
|
+
try:
|
|
311
|
+
nw = ipaddress.IPv4Network(net)
|
|
312
|
+
ip = ipaddress.IPv4Address(target)
|
|
313
|
+
if ip in nw:
|
|
314
|
+
return True
|
|
315
|
+
return False
|
|
316
|
+
except ipaddress.AddressValueError:
|
|
317
|
+
return False
|
|
318
|
+
except ipaddress.NetmaskValueError:
|
|
319
|
+
return False
|
|
320
|
+
|
|
321
|
+
def should_bypass_proxies(url, no_proxy=None):
|
|
322
|
+
""" Yet another requests.should_bypass_proxies
|
|
323
|
+
Test if proxies should not be used for a particular url.
|
|
324
|
+
"""
|
|
325
|
+
|
|
326
|
+
parsed = urlparse(url)
|
|
327
|
+
|
|
328
|
+
# special cases
|
|
329
|
+
if parsed.hostname in [None, '']:
|
|
330
|
+
return True
|
|
331
|
+
|
|
332
|
+
# special cases
|
|
333
|
+
if no_proxy in [None , '']:
|
|
334
|
+
return False
|
|
335
|
+
if no_proxy == '*':
|
|
336
|
+
return True
|
|
337
|
+
|
|
338
|
+
no_proxy = no_proxy.lower().replace(' ','');
|
|
339
|
+
entries = (
|
|
340
|
+
host for host in no_proxy.split(',') if host
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
if is_ipv4(parsed.hostname):
|
|
344
|
+
for item in entries:
|
|
345
|
+
if in_ipv4net(parsed.hostname, item):
|
|
346
|
+
return True
|
|
347
|
+
return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} )
|
fds/sdk/__init__.py
ADDED
|
File without changes
|