lockss-pyclient 0.1.0.dev1__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.
- lockss/pyclient/__init__.py +67 -0
- lockss/pyclient/config/__init__.py +42 -0
- lockss/pyclient/config/api/__init__.py +12 -0
- lockss/pyclient/config/api/aus_api.py +2195 -0
- lockss/pyclient/config/api/config_api.py +718 -0
- lockss/pyclient/config/api/plugins_api.py +128 -0
- lockss/pyclient/config/api/status_api.py +120 -0
- lockss/pyclient/config/api/tdb_api.py +318 -0
- lockss/pyclient/config/api/users_api.py +516 -0
- lockss/pyclient/config/api/utils_api.py +128 -0
- lockss/pyclient/config/api_client.py +632 -0
- lockss/pyclient/config/configuration.py +254 -0
- lockss/pyclient/config/models/__init__.py +30 -0
- lockss/pyclient/config/models/api_status.py +344 -0
- lockss/pyclient/config/models/au_configuration.py +142 -0
- lockss/pyclient/config/models/au_status.py +113 -0
- lockss/pyclient/config/models/au_ws_result.py +113 -0
- lockss/pyclient/config/models/auids_body.py +168 -0
- lockss/pyclient/config/models/check_substance_result.py +212 -0
- lockss/pyclient/config/models/content_configuration_result.py +200 -0
- lockss/pyclient/config/models/file_section_name_body.py +113 -0
- lockss/pyclient/config/models/platform_configuration_ws_result.py +113 -0
- lockss/pyclient/config/models/plugin_ws_result.py +345 -0
- lockss/pyclient/config/models/request_au_control_result.py +171 -0
- lockss/pyclient/config/models/tdb_au_ws_result.py +360 -0
- lockss/pyclient/config/models/tdb_publisher_ws_result.py +113 -0
- lockss/pyclient/config/models/tdb_title_ws_result.py +390 -0
- lockss/pyclient/config/rest.py +317 -0
- lockss/pyclient/crawler/__init__.py +45 -0
- lockss/pyclient/crawler/api/__init__.py +10 -0
- lockss/pyclient/crawler/api/crawlers_api.py +215 -0
- lockss/pyclient/crawler/api/crawls_api.py +952 -0
- lockss/pyclient/crawler/api/jobs_api.py +504 -0
- lockss/pyclient/crawler/api/status_api.py +120 -0
- lockss/pyclient/crawler/api/ws_api.py +128 -0
- lockss/pyclient/crawler/api_client.py +632 -0
- lockss/pyclient/crawler/configuration.py +254 -0
- lockss/pyclient/crawler/models/__init__.py +35 -0
- lockss/pyclient/crawler/models/api_status.py +344 -0
- lockss/pyclient/crawler/models/counter.py +142 -0
- lockss/pyclient/crawler/models/crawl_desc.py +344 -0
- lockss/pyclient/crawler/models/crawl_job.py +280 -0
- lockss/pyclient/crawler/models/crawl_pager.py +140 -0
- lockss/pyclient/crawler/models/crawl_status.py +780 -0
- lockss/pyclient/crawler/models/crawl_ws_result.py +814 -0
- lockss/pyclient/crawler/models/crawl_ws_result_pages_with_errors.py +162 -0
- lockss/pyclient/crawler/models/crawler_config.py +142 -0
- lockss/pyclient/crawler/models/crawler_status.py +279 -0
- lockss/pyclient/crawler/models/crawler_statuses.py +112 -0
- lockss/pyclient/crawler/models/error_result.py +164 -0
- lockss/pyclient/crawler/models/job_pager.py +140 -0
- lockss/pyclient/crawler/models/job_status.py +147 -0
- lockss/pyclient/crawler/models/mime_counter.py +169 -0
- lockss/pyclient/crawler/models/page_info.py +228 -0
- lockss/pyclient/crawler/models/url_error.py +148 -0
- lockss/pyclient/crawler/models/url_info.py +167 -0
- lockss/pyclient/crawler/models/url_pager.py +140 -0
- lockss/pyclient/crawler/rest.py +317 -0
- lockss/pyclient/md/__init__.py +36 -0
- lockss/pyclient/md/api/__init__.py +9 -0
- lockss/pyclient/md/api/mdupdates_api.py +508 -0
- lockss/pyclient/md/api/metadata_api.py +136 -0
- lockss/pyclient/md/api/status_api.py +120 -0
- lockss/pyclient/md/api/urls_api.py +224 -0
- lockss/pyclient/md/api_client.py +632 -0
- lockss/pyclient/md/configuration.py +254 -0
- lockss/pyclient/md/models/__init__.py +27 -0
- lockss/pyclient/md/models/api_status.py +344 -0
- lockss/pyclient/md/models/au.py +169 -0
- lockss/pyclient/md/models/au_metadata_page_info.py +140 -0
- lockss/pyclient/md/models/error_result.py +164 -0
- lockss/pyclient/md/models/item_metadata.py +196 -0
- lockss/pyclient/md/models/job.py +280 -0
- lockss/pyclient/md/models/job_page_info.py +140 -0
- lockss/pyclient/md/models/metadata_update_spec.py +142 -0
- lockss/pyclient/md/models/page_info.py +228 -0
- lockss/pyclient/md/models/status.py +142 -0
- lockss/pyclient/md/models/url_info.py +142 -0
- lockss/pyclient/md/rest.py +317 -0
- lockss/pyclient/poller/__init__.py +54 -0
- lockss/pyclient/poller/api/__init__.py +13 -0
- lockss/pyclient/poller/api/export_api.py +156 -0
- lockss/pyclient/poller/api/hash_api.py +413 -0
- lockss/pyclient/poller/api/import_api.py +157 -0
- lockss/pyclient/poller/api/poll_detail_api.py +374 -0
- lockss/pyclient/poller/api/poller_polls_api.py +223 -0
- lockss/pyclient/poller/api/repo_api.py +223 -0
- lockss/pyclient/poller/api/service_api.py +694 -0
- lockss/pyclient/poller/api/voter_polls_api.py +223 -0
- lockss/pyclient/poller/api_client.py +632 -0
- lockss/pyclient/poller/configuration.py +254 -0
- lockss/pyclient/poller/models/__init__.py +41 -0
- lockss/pyclient/poller/models/api_status.py +344 -0
- lockss/pyclient/poller/models/aus_import_body.py +199 -0
- lockss/pyclient/poller/models/cached_uri_set_spec.py +169 -0
- lockss/pyclient/poller/models/error_result.py +164 -0
- lockss/pyclient/poller/models/hasher_ws_params.py +432 -0
- lockss/pyclient/poller/models/link_desc.py +141 -0
- lockss/pyclient/poller/models/page_desc.py +227 -0
- lockss/pyclient/poller/models/peer_data.py +638 -0
- lockss/pyclient/poller/models/peer_ws_result.py +113 -0
- lockss/pyclient/poller/models/poll_desc.py +285 -0
- lockss/pyclient/poller/models/poll_ws_result.py +142 -0
- lockss/pyclient/poller/models/poller_detail.py +613 -0
- lockss/pyclient/poller/models/poller_pager.py +139 -0
- lockss/pyclient/poller/models/poller_summary.py +452 -0
- lockss/pyclient/poller/models/repair_data.py +176 -0
- lockss/pyclient/poller/models/repair_pager.py +139 -0
- lockss/pyclient/poller/models/repair_queue.py +249 -0
- lockss/pyclient/poller/models/repository_space_ws_result.py +113 -0
- lockss/pyclient/poller/models/repository_ws_result.py +113 -0
- lockss/pyclient/poller/models/tally_data.py +471 -0
- lockss/pyclient/poller/models/url_pager.py +139 -0
- lockss/pyclient/poller/models/vote_ws_result.py +142 -0
- lockss/pyclient/poller/models/voter_detail.py +701 -0
- lockss/pyclient/poller/models/voter_pager.py +139 -0
- lockss/pyclient/poller/models/voter_summary.py +284 -0
- lockss/pyclient/poller/rest.py +317 -0
- lockss/pyclient/rs/__init__.py +41 -0
- lockss/pyclient/rs/api/__init__.py +10 -0
- lockss/pyclient/rs/api/artifacts_api.py +988 -0
- lockss/pyclient/rs/api/aus_api.py +334 -0
- lockss/pyclient/rs/api/repo_api.py +379 -0
- lockss/pyclient/rs/api/status_api.py +120 -0
- lockss/pyclient/rs/api/wayback_api.py +386 -0
- lockss/pyclient/rs/api_client.py +632 -0
- lockss/pyclient/rs/configuration.py +247 -0
- lockss/pyclient/rs/models/__init__.py +31 -0
- lockss/pyclient/rs/models/api_status.py +344 -0
- lockss/pyclient/rs/models/archives_body.py +142 -0
- lockss/pyclient/rs/models/artifact.py +344 -0
- lockss/pyclient/rs/models/artifact_page_info.py +140 -0
- lockss/pyclient/rs/models/artifact_properties.py +344 -0
- lockss/pyclient/rs/models/artifacts_body.py +170 -0
- lockss/pyclient/rs/models/au_size.py +162 -0
- lockss/pyclient/rs/models/auid_page_info.py +140 -0
- lockss/pyclient/rs/models/error_result.py +164 -0
- lockss/pyclient/rs/models/import_status.py +298 -0
- lockss/pyclient/rs/models/page_info.py +229 -0
- lockss/pyclient/rs/models/repository_info.py +164 -0
- lockss/pyclient/rs/models/repository_statistics.py +112 -0
- lockss/pyclient/rs/models/storage_info.py +287 -0
- lockss/pyclient/rs/models/streaming_response_body.py +84 -0
- lockss/pyclient/rs/rest.py +317 -0
- lockss_pyclient-0.1.0.dev1.dist-info/LICENSE +27 -0
- lockss_pyclient-0.1.0.dev1.dist-info/METADATA +29 -0
- lockss_pyclient-0.1.0.dev1.dist-info/RECORD +148 -0
- lockss_pyclient-0.1.0.dev1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
LOCKSS Metadata Service REST API
|
|
5
|
+
|
|
6
|
+
REST API of the LOCKSS Metadata Service # noqa: E501
|
|
7
|
+
|
|
8
|
+
OpenAPI spec version: 2.0.0
|
|
9
|
+
Contact: lockss-support@lockss.org
|
|
10
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import absolute_import
|
|
14
|
+
|
|
15
|
+
import io
|
|
16
|
+
import json
|
|
17
|
+
import logging
|
|
18
|
+
import re
|
|
19
|
+
import ssl
|
|
20
|
+
|
|
21
|
+
import certifi
|
|
22
|
+
# python 2 and python 3 compatibility library
|
|
23
|
+
import six
|
|
24
|
+
from six.moves.urllib.parse import urlencode
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
import urllib3
|
|
28
|
+
except ImportError:
|
|
29
|
+
raise ImportError('Swagger python client requires urllib3.')
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
logger = logging.getLogger(__name__)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class RESTResponse(io.IOBase):
|
|
36
|
+
|
|
37
|
+
def __init__(self, resp):
|
|
38
|
+
self.urllib3_response = resp
|
|
39
|
+
self.status = resp.status
|
|
40
|
+
self.reason = resp.reason
|
|
41
|
+
self.data = resp.data
|
|
42
|
+
|
|
43
|
+
def getheaders(self):
|
|
44
|
+
"""Returns a dictionary of the response headers."""
|
|
45
|
+
return self.urllib3_response.headers
|
|
46
|
+
|
|
47
|
+
def getheader(self, name, default=None):
|
|
48
|
+
"""Returns a given response header."""
|
|
49
|
+
return self.urllib3_response.headers.get(name, default)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class RESTClientObject(object):
|
|
53
|
+
|
|
54
|
+
def __init__(self, configuration, pools_size=4, maxsize=None):
|
|
55
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
56
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
57
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
58
|
+
# maxsize is the number of requests to host that are allowed in parallel # noqa: E501
|
|
59
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
60
|
+
|
|
61
|
+
# cert_reqs
|
|
62
|
+
if configuration.verify_ssl:
|
|
63
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
64
|
+
else:
|
|
65
|
+
cert_reqs = ssl.CERT_NONE
|
|
66
|
+
|
|
67
|
+
# ca_certs
|
|
68
|
+
if configuration.ssl_ca_cert:
|
|
69
|
+
ca_certs = configuration.ssl_ca_cert
|
|
70
|
+
else:
|
|
71
|
+
# if not set certificate file, use Mozilla's root certificates.
|
|
72
|
+
ca_certs = certifi.where()
|
|
73
|
+
|
|
74
|
+
addition_pool_args = {}
|
|
75
|
+
if configuration.assert_hostname is not None:
|
|
76
|
+
addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
|
|
77
|
+
|
|
78
|
+
if maxsize is None:
|
|
79
|
+
if configuration.connection_pool_maxsize is not None:
|
|
80
|
+
maxsize = configuration.connection_pool_maxsize
|
|
81
|
+
else:
|
|
82
|
+
maxsize = 4
|
|
83
|
+
|
|
84
|
+
# https pool manager
|
|
85
|
+
if configuration.proxy:
|
|
86
|
+
self.pool_manager = urllib3.ProxyManager(
|
|
87
|
+
num_pools=pools_size,
|
|
88
|
+
maxsize=maxsize,
|
|
89
|
+
cert_reqs=cert_reqs,
|
|
90
|
+
ca_certs=ca_certs,
|
|
91
|
+
cert_file=configuration.cert_file,
|
|
92
|
+
key_file=configuration.key_file,
|
|
93
|
+
proxy_url=configuration.proxy,
|
|
94
|
+
**addition_pool_args
|
|
95
|
+
)
|
|
96
|
+
else:
|
|
97
|
+
self.pool_manager = urllib3.PoolManager(
|
|
98
|
+
num_pools=pools_size,
|
|
99
|
+
maxsize=maxsize,
|
|
100
|
+
cert_reqs=cert_reqs,
|
|
101
|
+
ca_certs=ca_certs,
|
|
102
|
+
cert_file=configuration.cert_file,
|
|
103
|
+
key_file=configuration.key_file,
|
|
104
|
+
**addition_pool_args
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
def request(self, method, url, query_params=None, headers=None,
|
|
108
|
+
body=None, post_params=None, _preload_content=True,
|
|
109
|
+
_request_timeout=None):
|
|
110
|
+
"""Perform requests.
|
|
111
|
+
|
|
112
|
+
:param method: http request method
|
|
113
|
+
:param url: http request url
|
|
114
|
+
:param query_params: query parameters in the url
|
|
115
|
+
:param headers: http request headers
|
|
116
|
+
:param body: request json body, for `application/json`
|
|
117
|
+
:param post_params: request post parameters,
|
|
118
|
+
`application/x-www-form-urlencoded`
|
|
119
|
+
and `multipart/form-data`
|
|
120
|
+
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
121
|
+
be returned without reading/decoding response
|
|
122
|
+
data. Default is True.
|
|
123
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
124
|
+
number provided, it will be total request
|
|
125
|
+
timeout. It can also be a pair (tuple) of
|
|
126
|
+
(connection, read) timeouts.
|
|
127
|
+
"""
|
|
128
|
+
method = method.upper()
|
|
129
|
+
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
|
|
130
|
+
'PATCH', 'OPTIONS']
|
|
131
|
+
|
|
132
|
+
if post_params and body:
|
|
133
|
+
raise ValueError(
|
|
134
|
+
"body parameter cannot be used with post_params parameter."
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
post_params = post_params or {}
|
|
138
|
+
headers = headers or {}
|
|
139
|
+
|
|
140
|
+
timeout = None
|
|
141
|
+
if _request_timeout:
|
|
142
|
+
if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821
|
|
143
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
144
|
+
elif (isinstance(_request_timeout, tuple) and
|
|
145
|
+
len(_request_timeout) == 2):
|
|
146
|
+
timeout = urllib3.Timeout(
|
|
147
|
+
connect=_request_timeout[0], read=_request_timeout[1])
|
|
148
|
+
|
|
149
|
+
if 'Content-Type' not in headers:
|
|
150
|
+
headers['Content-Type'] = 'application/json'
|
|
151
|
+
|
|
152
|
+
try:
|
|
153
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
154
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
|
155
|
+
if query_params:
|
|
156
|
+
url += '?' + urlencode(query_params)
|
|
157
|
+
if re.search('json', headers['Content-Type'], re.IGNORECASE):
|
|
158
|
+
request_body = '{}'
|
|
159
|
+
if body is not None:
|
|
160
|
+
request_body = json.dumps(body)
|
|
161
|
+
r = self.pool_manager.request(
|
|
162
|
+
method, url,
|
|
163
|
+
body=request_body,
|
|
164
|
+
preload_content=_preload_content,
|
|
165
|
+
timeout=timeout,
|
|
166
|
+
headers=headers)
|
|
167
|
+
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
|
|
168
|
+
r = self.pool_manager.request(
|
|
169
|
+
method, url,
|
|
170
|
+
fields=post_params,
|
|
171
|
+
encode_multipart=False,
|
|
172
|
+
preload_content=_preload_content,
|
|
173
|
+
timeout=timeout,
|
|
174
|
+
headers=headers)
|
|
175
|
+
elif headers['Content-Type'] == 'multipart/form-data':
|
|
176
|
+
# must del headers['Content-Type'], or the correct
|
|
177
|
+
# Content-Type which generated by urllib3 will be
|
|
178
|
+
# overwritten.
|
|
179
|
+
del headers['Content-Type']
|
|
180
|
+
r = self.pool_manager.request(
|
|
181
|
+
method, url,
|
|
182
|
+
fields=post_params,
|
|
183
|
+
encode_multipart=True,
|
|
184
|
+
preload_content=_preload_content,
|
|
185
|
+
timeout=timeout,
|
|
186
|
+
headers=headers)
|
|
187
|
+
# Pass a `string` parameter directly in the body to support
|
|
188
|
+
# other content types than Json when `body` argument is
|
|
189
|
+
# provided in serialized form
|
|
190
|
+
elif isinstance(body, str):
|
|
191
|
+
request_body = body
|
|
192
|
+
r = self.pool_manager.request(
|
|
193
|
+
method, url,
|
|
194
|
+
body=request_body,
|
|
195
|
+
preload_content=_preload_content,
|
|
196
|
+
timeout=timeout,
|
|
197
|
+
headers=headers)
|
|
198
|
+
else:
|
|
199
|
+
# Cannot generate the request from given parameters
|
|
200
|
+
msg = """Cannot prepare a request message for provided
|
|
201
|
+
arguments. Please check that your arguments match
|
|
202
|
+
declared content type."""
|
|
203
|
+
raise ApiException(status=0, reason=msg)
|
|
204
|
+
# For `GET`, `HEAD`
|
|
205
|
+
else:
|
|
206
|
+
r = self.pool_manager.request(method, url,
|
|
207
|
+
fields=query_params,
|
|
208
|
+
preload_content=_preload_content,
|
|
209
|
+
timeout=timeout,
|
|
210
|
+
headers=headers)
|
|
211
|
+
except urllib3.exceptions.SSLError as e:
|
|
212
|
+
msg = "{0}\n{1}".format(type(e).__name__, str(e))
|
|
213
|
+
raise ApiException(status=0, reason=msg)
|
|
214
|
+
|
|
215
|
+
if _preload_content:
|
|
216
|
+
r = RESTResponse(r)
|
|
217
|
+
|
|
218
|
+
# log response body
|
|
219
|
+
logger.debug("response body: %s", r.data)
|
|
220
|
+
|
|
221
|
+
if not 200 <= r.status <= 299:
|
|
222
|
+
raise ApiException(http_resp=r)
|
|
223
|
+
|
|
224
|
+
return r
|
|
225
|
+
|
|
226
|
+
def GET(self, url, headers=None, query_params=None, _preload_content=True,
|
|
227
|
+
_request_timeout=None):
|
|
228
|
+
return self.request("GET", url,
|
|
229
|
+
headers=headers,
|
|
230
|
+
_preload_content=_preload_content,
|
|
231
|
+
_request_timeout=_request_timeout,
|
|
232
|
+
query_params=query_params)
|
|
233
|
+
|
|
234
|
+
def HEAD(self, url, headers=None, query_params=None, _preload_content=True,
|
|
235
|
+
_request_timeout=None):
|
|
236
|
+
return self.request("HEAD", url,
|
|
237
|
+
headers=headers,
|
|
238
|
+
_preload_content=_preload_content,
|
|
239
|
+
_request_timeout=_request_timeout,
|
|
240
|
+
query_params=query_params)
|
|
241
|
+
|
|
242
|
+
def OPTIONS(self, url, headers=None, query_params=None, post_params=None,
|
|
243
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
244
|
+
return self.request("OPTIONS", url,
|
|
245
|
+
headers=headers,
|
|
246
|
+
query_params=query_params,
|
|
247
|
+
post_params=post_params,
|
|
248
|
+
_preload_content=_preload_content,
|
|
249
|
+
_request_timeout=_request_timeout,
|
|
250
|
+
body=body)
|
|
251
|
+
|
|
252
|
+
def DELETE(self, url, headers=None, query_params=None, body=None,
|
|
253
|
+
_preload_content=True, _request_timeout=None):
|
|
254
|
+
return self.request("DELETE", url,
|
|
255
|
+
headers=headers,
|
|
256
|
+
query_params=query_params,
|
|
257
|
+
_preload_content=_preload_content,
|
|
258
|
+
_request_timeout=_request_timeout,
|
|
259
|
+
body=body)
|
|
260
|
+
|
|
261
|
+
def POST(self, url, headers=None, query_params=None, post_params=None,
|
|
262
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
263
|
+
return self.request("POST", url,
|
|
264
|
+
headers=headers,
|
|
265
|
+
query_params=query_params,
|
|
266
|
+
post_params=post_params,
|
|
267
|
+
_preload_content=_preload_content,
|
|
268
|
+
_request_timeout=_request_timeout,
|
|
269
|
+
body=body)
|
|
270
|
+
|
|
271
|
+
def PUT(self, url, headers=None, query_params=None, post_params=None,
|
|
272
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
273
|
+
return self.request("PUT", url,
|
|
274
|
+
headers=headers,
|
|
275
|
+
query_params=query_params,
|
|
276
|
+
post_params=post_params,
|
|
277
|
+
_preload_content=_preload_content,
|
|
278
|
+
_request_timeout=_request_timeout,
|
|
279
|
+
body=body)
|
|
280
|
+
|
|
281
|
+
def PATCH(self, url, headers=None, query_params=None, post_params=None,
|
|
282
|
+
body=None, _preload_content=True, _request_timeout=None):
|
|
283
|
+
return self.request("PATCH", url,
|
|
284
|
+
headers=headers,
|
|
285
|
+
query_params=query_params,
|
|
286
|
+
post_params=post_params,
|
|
287
|
+
_preload_content=_preload_content,
|
|
288
|
+
_request_timeout=_request_timeout,
|
|
289
|
+
body=body)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
class ApiException(Exception):
|
|
293
|
+
|
|
294
|
+
def __init__(self, status=None, reason=None, http_resp=None):
|
|
295
|
+
if http_resp:
|
|
296
|
+
self.status = http_resp.status
|
|
297
|
+
self.reason = http_resp.reason
|
|
298
|
+
self.body = http_resp.data
|
|
299
|
+
self.headers = http_resp.getheaders()
|
|
300
|
+
else:
|
|
301
|
+
self.status = status
|
|
302
|
+
self.reason = reason
|
|
303
|
+
self.body = None
|
|
304
|
+
self.headers = None
|
|
305
|
+
|
|
306
|
+
def __str__(self):
|
|
307
|
+
"""Custom error messages for exception"""
|
|
308
|
+
error_message = "({0})\n"\
|
|
309
|
+
"Reason: {1}\n".format(self.status, self.reason)
|
|
310
|
+
if self.headers:
|
|
311
|
+
error_message += "HTTP response headers: {0}\n".format(
|
|
312
|
+
self.headers)
|
|
313
|
+
|
|
314
|
+
if self.body:
|
|
315
|
+
error_message += "HTTP response body: {0}\n".format(self.body)
|
|
316
|
+
|
|
317
|
+
return error_message
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# flake8: noqa
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
LOCKSS Poller Service REST API
|
|
7
|
+
|
|
8
|
+
REST API of the LOCKSS Poller Service # noqa: E501
|
|
9
|
+
|
|
10
|
+
OpenAPI spec version: 2.0.0
|
|
11
|
+
Contact: lockss-support@lockss.org
|
|
12
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import absolute_import
|
|
16
|
+
|
|
17
|
+
# import apis into sdk package
|
|
18
|
+
from lockss.pyclient.poller.api.export_api import ExportApi
|
|
19
|
+
from lockss.pyclient.poller.api.hash_api import HashApi
|
|
20
|
+
from lockss.pyclient.poller.api.import_api import ImportApi
|
|
21
|
+
from lockss.pyclient.poller.api.poll_detail_api import PollDetailApi
|
|
22
|
+
from lockss.pyclient.poller.api.poller_polls_api import PollerPollsApi
|
|
23
|
+
from lockss.pyclient.poller.api.repo_api import RepoApi
|
|
24
|
+
from lockss.pyclient.poller.api.service_api import ServiceApi
|
|
25
|
+
from lockss.pyclient.poller.api.voter_polls_api import VoterPollsApi
|
|
26
|
+
# import ApiClient
|
|
27
|
+
from lockss.pyclient.poller.api_client import ApiClient
|
|
28
|
+
from lockss.pyclient.poller.configuration import Configuration
|
|
29
|
+
# import models into sdk package
|
|
30
|
+
from lockss.pyclient.poller.models.api_status import ApiStatus
|
|
31
|
+
from lockss.pyclient.poller.models.aus_import_body import AusImportBody
|
|
32
|
+
from lockss.pyclient.poller.models.cached_uri_set_spec import CachedUriSetSpec
|
|
33
|
+
from lockss.pyclient.poller.models.error_result import ErrorResult
|
|
34
|
+
from lockss.pyclient.poller.models.hasher_ws_params import HasherWsParams
|
|
35
|
+
from lockss.pyclient.poller.models.link_desc import LinkDesc
|
|
36
|
+
from lockss.pyclient.poller.models.page_desc import PageDesc
|
|
37
|
+
from lockss.pyclient.poller.models.peer_data import PeerData
|
|
38
|
+
from lockss.pyclient.poller.models.peer_ws_result import PeerWsResult
|
|
39
|
+
from lockss.pyclient.poller.models.poll_desc import PollDesc
|
|
40
|
+
from lockss.pyclient.poller.models.poll_ws_result import PollWsResult
|
|
41
|
+
from lockss.pyclient.poller.models.poller_detail import PollerDetail
|
|
42
|
+
from lockss.pyclient.poller.models.poller_pager import PollerPager
|
|
43
|
+
from lockss.pyclient.poller.models.poller_summary import PollerSummary
|
|
44
|
+
from lockss.pyclient.poller.models.repair_data import RepairData
|
|
45
|
+
from lockss.pyclient.poller.models.repair_pager import RepairPager
|
|
46
|
+
from lockss.pyclient.poller.models.repair_queue import RepairQueue
|
|
47
|
+
from lockss.pyclient.poller.models.repository_space_ws_result import RepositorySpaceWsResult
|
|
48
|
+
from lockss.pyclient.poller.models.repository_ws_result import RepositoryWsResult
|
|
49
|
+
from lockss.pyclient.poller.models.tally_data import TallyData
|
|
50
|
+
from lockss.pyclient.poller.models.url_pager import UrlPager
|
|
51
|
+
from lockss.pyclient.poller.models.vote_ws_result import VoteWsResult
|
|
52
|
+
from lockss.pyclient.poller.models.voter_detail import VoterDetail
|
|
53
|
+
from lockss.pyclient.poller.models.voter_pager import VoterPager
|
|
54
|
+
from lockss.pyclient.poller.models.voter_summary import VoterSummary
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
# flake8: noqa
|
|
4
|
+
|
|
5
|
+
# import apis into api package
|
|
6
|
+
from lockss.pyclient.poller.api.export_api import ExportApi
|
|
7
|
+
from lockss.pyclient.poller.api.hash_api import HashApi
|
|
8
|
+
from lockss.pyclient.poller.api.import_api import ImportApi
|
|
9
|
+
from lockss.pyclient.poller.api.poll_detail_api import PollDetailApi
|
|
10
|
+
from lockss.pyclient.poller.api.poller_polls_api import PollerPollsApi
|
|
11
|
+
from lockss.pyclient.poller.api.repo_api import RepoApi
|
|
12
|
+
from lockss.pyclient.poller.api.service_api import ServiceApi
|
|
13
|
+
from lockss.pyclient.poller.api.voter_polls_api import VoterPollsApi
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
LOCKSS Poller Service REST API
|
|
5
|
+
|
|
6
|
+
REST API of the LOCKSS Poller Service # noqa: E501
|
|
7
|
+
|
|
8
|
+
OpenAPI spec version: 2.0.0
|
|
9
|
+
Contact: lockss-support@lockss.org
|
|
10
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import absolute_import
|
|
14
|
+
|
|
15
|
+
import re # noqa: F401
|
|
16
|
+
|
|
17
|
+
# python 2 and python 3 compatibility library
|
|
18
|
+
import six
|
|
19
|
+
|
|
20
|
+
from lockss.pyclient.poller.api_client import ApiClient
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ExportApi(object):
|
|
24
|
+
"""NOTE: This class is auto generated by the swagger code generator program.
|
|
25
|
+
|
|
26
|
+
Do not edit the class manually.
|
|
27
|
+
Ref: https://github.com/swagger-api/swagger-codegen
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self, api_client=None):
|
|
31
|
+
if api_client is None:
|
|
32
|
+
api_client = ApiClient()
|
|
33
|
+
self.api_client = api_client
|
|
34
|
+
|
|
35
|
+
def get_export_files(self, auid, **kwargs): # noqa: E501
|
|
36
|
+
"""Export artifacts in an Archival Unit # noqa: E501
|
|
37
|
+
|
|
38
|
+
Export artifacts in an Archival Unit as a group of archives # noqa: E501
|
|
39
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
40
|
+
asynchronous HTTP request, please pass async_req=True
|
|
41
|
+
>>> thread = api.get_export_files(auid, async_req=True)
|
|
42
|
+
>>> result = thread.get()
|
|
43
|
+
|
|
44
|
+
:param async_req bool
|
|
45
|
+
:param str auid: Identifier of the Archival Unit containing the artifacts (required)
|
|
46
|
+
:param str file_type: The type of archive to create
|
|
47
|
+
:param bool is_compress: Indication of whether contents should be compressed
|
|
48
|
+
:param bool is_exclude_dir_nodes: Indication of whether directories should be excluded
|
|
49
|
+
:param str xlate_filenames: Type of filename translation to be done
|
|
50
|
+
:param str file_prefix: The prefix to be used to name the exported file
|
|
51
|
+
:param int max_size: The maximum size of the exported file
|
|
52
|
+
:param int max_versions: The maximum number of versions of an artifact to be exported
|
|
53
|
+
:return: str
|
|
54
|
+
If the method is called asynchronously,
|
|
55
|
+
returns the request thread.
|
|
56
|
+
"""
|
|
57
|
+
kwargs['_return_http_data_only'] = True
|
|
58
|
+
if kwargs.get('async_req'):
|
|
59
|
+
return self.get_export_files_with_http_info(auid, **kwargs) # noqa: E501
|
|
60
|
+
else:
|
|
61
|
+
(data) = self.get_export_files_with_http_info(auid, **kwargs) # noqa: E501
|
|
62
|
+
return data
|
|
63
|
+
|
|
64
|
+
def get_export_files_with_http_info(self, auid, **kwargs): # noqa: E501
|
|
65
|
+
"""Export artifacts in an Archival Unit # noqa: E501
|
|
66
|
+
|
|
67
|
+
Export artifacts in an Archival Unit as a group of archives # noqa: E501
|
|
68
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
69
|
+
asynchronous HTTP request, please pass async_req=True
|
|
70
|
+
>>> thread = api.get_export_files_with_http_info(auid, async_req=True)
|
|
71
|
+
>>> result = thread.get()
|
|
72
|
+
|
|
73
|
+
:param async_req bool
|
|
74
|
+
:param str auid: Identifier of the Archival Unit containing the artifacts (required)
|
|
75
|
+
:param str file_type: The type of archive to create
|
|
76
|
+
:param bool is_compress: Indication of whether contents should be compressed
|
|
77
|
+
:param bool is_exclude_dir_nodes: Indication of whether directories should be excluded
|
|
78
|
+
:param str xlate_filenames: Type of filename translation to be done
|
|
79
|
+
:param str file_prefix: The prefix to be used to name the exported file
|
|
80
|
+
:param int max_size: The maximum size of the exported file
|
|
81
|
+
:param int max_versions: The maximum number of versions of an artifact to be exported
|
|
82
|
+
:return: str
|
|
83
|
+
If the method is called asynchronously,
|
|
84
|
+
returns the request thread.
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
all_params = ['auid', 'file_type', 'is_compress', 'is_exclude_dir_nodes', 'xlate_filenames', 'file_prefix', 'max_size', 'max_versions'] # noqa: E501
|
|
88
|
+
all_params.append('async_req')
|
|
89
|
+
all_params.append('_return_http_data_only')
|
|
90
|
+
all_params.append('_preload_content')
|
|
91
|
+
all_params.append('_request_timeout')
|
|
92
|
+
|
|
93
|
+
params = locals()
|
|
94
|
+
for key, val in six.iteritems(params['kwargs']):
|
|
95
|
+
if key not in all_params:
|
|
96
|
+
raise TypeError(
|
|
97
|
+
"Got an unexpected keyword argument '%s'"
|
|
98
|
+
" to method get_export_files" % key
|
|
99
|
+
)
|
|
100
|
+
params[key] = val
|
|
101
|
+
del params['kwargs']
|
|
102
|
+
# verify the required parameter 'auid' is set
|
|
103
|
+
if ('auid' not in params or
|
|
104
|
+
params['auid'] is None):
|
|
105
|
+
raise ValueError("Missing the required parameter `auid` when calling `get_export_files`") # noqa: E501
|
|
106
|
+
|
|
107
|
+
collection_formats = {}
|
|
108
|
+
|
|
109
|
+
path_params = {}
|
|
110
|
+
if 'auid' in params:
|
|
111
|
+
path_params['auid'] = params['auid'] # noqa: E501
|
|
112
|
+
|
|
113
|
+
query_params = []
|
|
114
|
+
if 'file_type' in params:
|
|
115
|
+
query_params.append(('fileType', params['file_type'])) # noqa: E501
|
|
116
|
+
if 'is_compress' in params:
|
|
117
|
+
query_params.append(('isCompress', params['is_compress'])) # noqa: E501
|
|
118
|
+
if 'is_exclude_dir_nodes' in params:
|
|
119
|
+
query_params.append(('isExcludeDirNodes', params['is_exclude_dir_nodes'])) # noqa: E501
|
|
120
|
+
if 'xlate_filenames' in params:
|
|
121
|
+
query_params.append(('xlateFilenames', params['xlate_filenames'])) # noqa: E501
|
|
122
|
+
if 'file_prefix' in params:
|
|
123
|
+
query_params.append(('filePrefix', params['file_prefix'])) # noqa: E501
|
|
124
|
+
if 'max_size' in params:
|
|
125
|
+
query_params.append(('maxSize', params['max_size'])) # noqa: E501
|
|
126
|
+
if 'max_versions' in params:
|
|
127
|
+
query_params.append(('maxVersions', params['max_versions'])) # noqa: E501
|
|
128
|
+
|
|
129
|
+
header_params = {}
|
|
130
|
+
|
|
131
|
+
form_params = []
|
|
132
|
+
local_var_files = {}
|
|
133
|
+
|
|
134
|
+
body_params = None
|
|
135
|
+
# HTTP header `Accept`
|
|
136
|
+
header_params['Accept'] = self.api_client.select_header_accept(
|
|
137
|
+
['multipart/form-data', 'application/json']) # noqa: E501
|
|
138
|
+
|
|
139
|
+
# Authentication setting
|
|
140
|
+
auth_settings = ['basicAuth'] # noqa: E501
|
|
141
|
+
|
|
142
|
+
return self.api_client.call_api(
|
|
143
|
+
'/aus/{auid}/export', 'GET',
|
|
144
|
+
path_params,
|
|
145
|
+
query_params,
|
|
146
|
+
header_params,
|
|
147
|
+
body=body_params,
|
|
148
|
+
post_params=form_params,
|
|
149
|
+
files=local_var_files,
|
|
150
|
+
response_type='str', # noqa: E501
|
|
151
|
+
auth_settings=auth_settings,
|
|
152
|
+
async_req=params.get('async_req'),
|
|
153
|
+
_return_http_data_only=params.get('_return_http_data_only'),
|
|
154
|
+
_preload_content=params.get('_preload_content', True),
|
|
155
|
+
_request_timeout=params.get('_request_timeout'),
|
|
156
|
+
collection_formats=collection_formats)
|