accsyn-python-api 3.0.0__tar.gz → 3.0.1__tar.gz
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.
- accsyn-python-api-3.0.1/.gitignore +9 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/PKG-INFO +1 -1
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/release_notes.rst +7 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/setup.py +1 -1
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_api/session.py +41 -37
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_python_api.egg-info/PKG-INFO +1 -1
- accsyn-python-api-3.0.0/.gitignore +0 -1
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/.github/workflows/github-actions-black.yml +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/.pre-commit-config.yaml +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/.readthedocs.yaml +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/README.md +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/_static/accsyn.css +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/api_reference/index.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/api_reference/session.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/clients.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/conf.py +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/datatypes.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/file.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/glossary.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/index.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/installing.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/introduction.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/jobs.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/misc.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/publish.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/queues.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/render.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/requirements.txt +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/shares.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/users.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/doc/using.rst +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/pyproject.toml +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/readthedocs.yaml +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/setup.cfg +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_api/__init__.py +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_api/_version.py +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_python_api.egg-info/SOURCES.txt +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_python_api.egg-info/dependency_links.txt +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_python_api.egg-info/requires.txt +0 -0
- {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_python_api.egg-info/top_level.txt +0 -0
|
@@ -166,6 +166,7 @@ class Session(object):
|
|
|
166
166
|
self.__version__ = __version__
|
|
167
167
|
self._session_id = str(uuid.uuid4())
|
|
168
168
|
self._uid = None
|
|
169
|
+
self._api_key = None
|
|
169
170
|
self._be_verbose = verbose
|
|
170
171
|
self._pretty_json = pretty_json
|
|
171
172
|
self._proxy = proxy
|
|
@@ -176,33 +177,29 @@ class Session(object):
|
|
|
176
177
|
for key in os.environ:
|
|
177
178
|
if key.startswith("FILMHUB_"):
|
|
178
179
|
Session._warning('Found old FilmHUB product environment variable "{}", ' "please migrate!".format(key))
|
|
179
|
-
if domain
|
|
180
|
-
|
|
181
|
-
"ACCSYN_DOMAIN"
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
"Please supply your accsyn domain/organization or set " "ACCSYN_DOMAIN environment!"
|
|
180
|
+
if not domain:
|
|
181
|
+
domain = (
|
|
182
|
+
os.environ["ACCSYN_DOMAIN"]
|
|
183
|
+
if "ACCSYN_DOMAIN" in os.environ
|
|
184
|
+
else os.environ.get(
|
|
185
|
+
"ACCSYN_ORG",
|
|
186
186
|
)
|
|
187
|
-
self._domain = domain or (
|
|
188
|
-
os.environ["ACCSYN_DOMAIN"]
|
|
189
|
-
if "ACCSYN_DOMAIN" in os.environ
|
|
190
|
-
else os.environ.get(
|
|
191
|
-
"ACCSYN_ORG",
|
|
192
187
|
)
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
if not domain:
|
|
189
|
+
raise AccsynException(
|
|
190
|
+
"Please supply your accsyn domain/organization or set " "ACCSYN_DOMAIN environment!"
|
|
191
|
+
)
|
|
192
|
+
if not username:
|
|
193
|
+
username = os.environ.get("ACCSYN_API_USER")
|
|
194
|
+
if not username:
|
|
195
195
|
if not ("ACCSYN_API_USER" in os.environ):
|
|
196
|
-
raise
|
|
197
|
-
"Please supply your accsyn user name (E-mail) or set
|
|
196
|
+
raise AccsynException(
|
|
197
|
+
"Please supply your accsyn user name (E-mail) or set ACCSYN_API_USER environment!"
|
|
198
198
|
)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
self._api_key = os.environ.get("ACCSYN_API_KEY")
|
|
204
|
-
if not self._api_key:
|
|
205
|
-
raise accsynException("Please supply your accsyn API KEY or set ACCSYN_API_KEY environment!")
|
|
199
|
+
if not api_key:
|
|
200
|
+
api_key = os.environ.get("ACCSYN_API_KEY")
|
|
201
|
+
if not api_key:
|
|
202
|
+
raise AccsynException("Please supply your accsyn API KEY or set ACCSYN_API_KEY environment!")
|
|
206
203
|
self._hostname = hostname
|
|
207
204
|
self._port = port
|
|
208
205
|
self._timeout = timeout or Session.DEFAULT_TIMEOUT
|
|
@@ -212,19 +209,25 @@ class Session(object):
|
|
|
212
209
|
self._hostname = "127.0.0.1"
|
|
213
210
|
else:
|
|
214
211
|
# Get domain
|
|
215
|
-
|
|
216
|
-
"
|
|
212
|
+
response = self._rest(
|
|
213
|
+
"GET",
|
|
217
214
|
ACCSYN_BACKEND_MASTER_HOSTNAME,
|
|
218
|
-
"
|
|
219
|
-
{"ident":
|
|
215
|
+
"J3PKTtDvolDMBtTy6AFGA",
|
|
216
|
+
{"ident": domain},
|
|
220
217
|
)
|
|
221
218
|
# Store hostname
|
|
219
|
+
if "message" in response:
|
|
220
|
+
raise AccsynException(response["message"])
|
|
221
|
+
result = response.get('result', {})
|
|
222
222
|
assert "hostname" in result, "No API endpoint hostname were provided for us!"
|
|
223
223
|
self._hostname = result["hostname"]
|
|
224
224
|
if self._port is None:
|
|
225
225
|
self._port = result["port"]
|
|
226
226
|
if self._port is None:
|
|
227
227
|
self._port = ACCSYN_PORT if not self._dev else 8181
|
|
228
|
+
self._domain = domain
|
|
229
|
+
self._username = username
|
|
230
|
+
self._api_key = api_key
|
|
228
231
|
self._last_message = None
|
|
229
232
|
self.login()
|
|
230
233
|
|
|
@@ -324,7 +327,7 @@ class Session(object):
|
|
|
324
327
|
if os.path.exists(data):
|
|
325
328
|
data = json.load(open(data, "r"))
|
|
326
329
|
else:
|
|
327
|
-
raise
|
|
330
|
+
raise AccsynException(
|
|
328
331
|
"Cannot build JSON payload data, not a valid JSON " "string or path to a JSON file!"
|
|
329
332
|
)
|
|
330
333
|
else:
|
|
@@ -949,7 +952,7 @@ class Session(object):
|
|
|
949
952
|
:return: Processed publish data, see documentation.
|
|
950
953
|
"""
|
|
951
954
|
if data is None or not isinstance(data, list):
|
|
952
|
-
raise
|
|
955
|
+
raise AccsynException("None or empty data supplied!")
|
|
953
956
|
|
|
954
957
|
# Check entries, calculate size
|
|
955
958
|
def recursive_get_size(files):
|
|
@@ -1148,7 +1151,7 @@ class Session(object):
|
|
|
1148
1151
|
Session._warning('Python lacks SOCKS support, please install "pysocks" and' " try again...")
|
|
1149
1152
|
raise ie
|
|
1150
1153
|
elif proxy_type is not None:
|
|
1151
|
-
raise
|
|
1154
|
+
raise AccsynException('Unknown proxy type "{}"!'.format(proxy_type))
|
|
1152
1155
|
url = "http{}://{}:{}/api/v3{}".format(
|
|
1153
1156
|
"s" if ssl else "",
|
|
1154
1157
|
hostname,
|
|
@@ -1164,9 +1167,10 @@ class Session(object):
|
|
|
1164
1167
|
r = None
|
|
1165
1168
|
retval = None
|
|
1166
1169
|
|
|
1170
|
+
headers_effective = dict()
|
|
1167
1171
|
if headers:
|
|
1168
1172
|
headers_effective = copy.deepcopy(headers)
|
|
1169
|
-
|
|
1173
|
+
elif self._api_key:
|
|
1170
1174
|
headers_effective = {
|
|
1171
1175
|
"Authorization": "basic {}:{}".format(
|
|
1172
1176
|
Session._base64_encode(self._username),
|
|
@@ -1229,7 +1233,7 @@ class Session(object):
|
|
|
1229
1233
|
# break
|
|
1230
1234
|
except BaseException:
|
|
1231
1235
|
# if timeout <= 0:
|
|
1232
|
-
raise
|
|
1236
|
+
raise AccsynException(
|
|
1233
1237
|
"Could not reach {}:{}! Make sure backend({}) can"
|
|
1234
1238
|
" be reached from you location and no firewall is "
|
|
1235
1239
|
"blocking outgoing TCP traffic at port {}. "
|
|
@@ -1267,7 +1271,7 @@ class Session(object):
|
|
|
1267
1271
|
traceback.format_exc(),
|
|
1268
1272
|
)
|
|
1269
1273
|
Session._warning(message)
|
|
1270
|
-
raise
|
|
1274
|
+
raise AccsynException(message)
|
|
1271
1275
|
|
|
1272
1276
|
if "exception" in retval:
|
|
1273
1277
|
message = "{} caused an exception! Please contact {} admin for more"
|
|
@@ -1275,11 +1279,11 @@ class Session(object):
|
|
|
1275
1279
|
Session._warning(message)
|
|
1276
1280
|
if self._role in [CLEARANCE_ADMIN, CLEARANCE_SUPPORT]:
|
|
1277
1281
|
Session._warning(retval["exception"])
|
|
1278
|
-
raise
|
|
1282
|
+
raise AccsynException(message)
|
|
1279
1283
|
elif "message" in retval:
|
|
1280
1284
|
message_effective = retval.get("message_hr") or retval["message"]
|
|
1281
1285
|
Session._warning(message_effective)
|
|
1282
|
-
raise
|
|
1286
|
+
raise AccsynException(message_effective)
|
|
1283
1287
|
return retval
|
|
1284
1288
|
|
|
1285
1289
|
# REST get
|
|
@@ -1509,6 +1513,6 @@ class Session(object):
|
|
|
1509
1513
|
return binascii.b2a_base64(s)
|
|
1510
1514
|
|
|
1511
1515
|
|
|
1512
|
-
class
|
|
1516
|
+
class AccsynException(Exception):
|
|
1513
1517
|
def __init__(self, message):
|
|
1514
|
-
super(
|
|
1518
|
+
super(AccsynException, self).__init__(message)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
*.pyc
|
{accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/.github/workflows/github-actions-black.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_python_api.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_python_api.egg-info/requires.txt
RENAMED
|
File without changes
|
{accsyn-python-api-3.0.0 → accsyn-python-api-3.0.1}/source/accsyn_python_api.egg-info/top_level.txt
RENAMED
|
File without changes
|