accsyn-python-api 3.0.0__tar.gz → 3.0.2__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.
Files changed (40) hide show
  1. accsyn-python-api-3.0.2/.gitignore +9 -0
  2. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/PKG-INFO +1 -1
  3. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/release_notes.rst +14 -0
  4. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/setup.py +1 -1
  5. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/source/accsyn_api/session.py +52 -48
  6. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/source/accsyn_python_api.egg-info/PKG-INFO +1 -1
  7. accsyn-python-api-3.0.0/.gitignore +0 -1
  8. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/.github/workflows/github-actions-black.yml +0 -0
  9. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/.pre-commit-config.yaml +0 -0
  10. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/.readthedocs.yaml +0 -0
  11. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/README.md +0 -0
  12. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/_static/accsyn.css +0 -0
  13. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/api_reference/index.rst +0 -0
  14. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/api_reference/session.rst +0 -0
  15. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/clients.rst +0 -0
  16. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/conf.py +0 -0
  17. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/datatypes.rst +0 -0
  18. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/file.rst +0 -0
  19. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/glossary.rst +0 -0
  20. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/index.rst +0 -0
  21. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/installing.rst +0 -0
  22. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/introduction.rst +0 -0
  23. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/jobs.rst +0 -0
  24. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/misc.rst +0 -0
  25. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/publish.rst +0 -0
  26. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/queues.rst +0 -0
  27. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/render.rst +0 -0
  28. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/requirements.txt +0 -0
  29. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/shares.rst +0 -0
  30. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/users.rst +0 -0
  31. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/doc/using.rst +0 -0
  32. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/pyproject.toml +0 -0
  33. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/readthedocs.yaml +0 -0
  34. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/setup.cfg +0 -0
  35. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/source/accsyn_api/__init__.py +0 -0
  36. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/source/accsyn_api/_version.py +0 -0
  37. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/source/accsyn_python_api.egg-info/SOURCES.txt +0 -0
  38. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/source/accsyn_python_api.egg-info/dependency_links.txt +0 -0
  39. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/source/accsyn_python_api.egg-info/requires.txt +0 -0
  40. {accsyn-python-api-3.0.0 → accsyn-python-api-3.0.2}/source/accsyn_python_api.egg-info/top_level.txt +0 -0
@@ -0,0 +1,9 @@
1
+ *.pyc
2
+ .eggs
3
+ .idea
4
+ dist
5
+ build
6
+ deploy.sh
7
+ doc/_build
8
+ accsyn_python_api.egg-info
9
+ .DS_Store
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accsyn-python-api
3
- Version: 3.0.0
3
+ Version: 3.0.2
4
4
  Summary: A Python API for accsyn programmable fast and secure data delivery software
5
5
  Home-page: https://github.com/accsyn/accsyn-python-api.git
6
6
  Author: Henrik Norin
@@ -13,6 +13,20 @@ Release Notes
13
13
 
14
14
  `https://support.accsyn.com <https://support.accsyn.com>`_.
15
15
 
16
+ .. release:: 3.0.2
17
+ :date: 2024-11-18
18
+
19
+ .. change:: fix
20
+
21
+ * Replaced organization > workspace.
22
+
23
+ .. release:: 3.0.1
24
+ :date: 2024-11-18
25
+
26
+ .. change:: fix
27
+
28
+ * Bug fixes.
29
+
16
30
  .. release:: 3.0.0
17
31
  :date: 2024-11-17
18
32
 
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name='accsyn-python-api',
8
- version='3.0.0',
8
+ version='3.0.2',
9
9
  package_dir={'': 'source'},
10
10
  packages=['accsyn_api'],
11
11
  setup_requires=[
@@ -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 is None:
180
- if not (
181
- "ACCSYN_DOMAIN" in os.environ
182
- or "ACCSYN_ORG" in os.environ
183
- ):
184
- raise accsynException(
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
- if username is None:
188
+ if not domain:
189
+ raise AccsynException(
190
+ "Please supply your accsyn domain/workspace 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 accsynException(
197
- "Please supply your accsyn user name (E-mail) or set " "ACCSYN_API_USER environment!"
196
+ raise AccsynException(
197
+ "Please supply your accsyn user name (E-mail) or set ACCSYN_API_USER environment!"
198
198
  )
199
- self._username = username or os.environ.get("ACCSYN_API_USER")
200
- if api_key:
201
- self._api_key = api_key
202
- else:
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
- result = self._rest(
216
- "PUT",
212
+ response = self._rest(
213
+ "GET",
217
214
  ACCSYN_BACKEND_MASTER_HOSTNAME,
218
- "workspace/J3PKTtDvolDMBtTy6AFGA",
219
- {"ident": self._domain},
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 accsynException(
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:
@@ -799,7 +802,7 @@ class Session(object):
799
802
  data["include"] = include
800
803
  if exclude:
801
804
  data["exclude"] = exclude
802
- response = self._event("GET", "organization/file", data)
805
+ response = self._event("GET", "workspace/file", data)
803
806
  if response:
804
807
  return response["result"]
805
808
 
@@ -828,7 +831,7 @@ class Session(object):
828
831
  data["include"] = include
829
832
  if exclude:
830
833
  data["exclude"] = exclude
831
- response = self._event("GET", "organization/file", data)
834
+ response = self._event("GET", "workspace/file", data)
832
835
  if response:
833
836
  return response["result"]
834
837
 
@@ -846,7 +849,7 @@ class Session(object):
846
849
  "op": "exists",
847
850
  "path": path,
848
851
  }
849
- response = self._event("GET", "organization/file", data)
852
+ response = self._event("GET", "workspace/file", data)
850
853
  if response:
851
854
  return response["result"]
852
855
 
@@ -866,7 +869,7 @@ class Session(object):
866
869
  "op": "mkdir",
867
870
  "path": path,
868
871
  }
869
- response = self._event("POST", "organization/file", data)
872
+ response = self._event("POST", "workspace/file", data)
870
873
  if response:
871
874
  return response["result"]
872
875
 
@@ -891,7 +894,7 @@ class Session(object):
891
894
  "path": path,
892
895
  "path_to": path_to,
893
896
  }
894
- response = self._event("PUT", "organization/file", data)
897
+ response = self._event("PUT", "workspace/file", data)
895
898
  if response:
896
899
  return response["result"]
897
900
 
@@ -916,7 +919,7 @@ class Session(object):
916
919
  "path": path_src,
917
920
  "path_to": path_dst,
918
921
  }
919
- response = self._event("PUT", "organization/file", data)
922
+ response = self._event("PUT", "workspace/file", data)
920
923
  if response:
921
924
  return response["result"]
922
925
 
@@ -936,7 +939,7 @@ class Session(object):
936
939
  "op": "mkdir",
937
940
  "path": path,
938
941
  }
939
- response = self._event("POST", "organization/file", data)
942
+ response = self._event("POST", "workspace/file", data)
940
943
  if response:
941
944
  return response["result"]
942
945
 
@@ -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 accsynException("None or empty data supplied!")
955
+ raise AccsynException("None or empty data supplied!")
953
956
 
954
957
  # Check entries, calculate size
955
958
  def recursive_get_size(files):
@@ -963,7 +966,7 @@ class Session(object):
963
966
  return result
964
967
 
965
968
  event_data = {"files": data, "size": recursive_get_size(data)}
966
- response = self._event("PUT", "organization/publish/preprocess", event_data)
969
+ response = self._event("PUT", "workspace/publish/preprocess", event_data)
967
970
  return response["result"]
968
971
 
969
972
  # Settings
@@ -1043,7 +1046,7 @@ class Session(object):
1043
1046
  assert len(operation) > 0, 'No operation provided'
1044
1047
  return self._event(
1045
1048
  "PUT",
1046
- "organization/integration/{}/utility".format(name),
1049
+ "workspace/integration/{}/utility".format(name),
1047
1050
  {
1048
1051
  'operation': operation,
1049
1052
  'data': data,
@@ -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 accsynException('Unknown proxy type "{}"!'.format(proxy_type))
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
- else:
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 accsynException(
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 accsynException(message)
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 accsynException(message)
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 accsynException(message_effective)
1286
+ raise AccsynException(message_effective)
1283
1287
  return retval
1284
1288
 
1285
1289
  # REST get
@@ -1427,9 +1431,9 @@ class Session(object):
1427
1431
  uri_base = entitytype
1428
1432
  # Send query to server, first determine uri
1429
1433
  # if entitytype == 'share':
1430
- # uri_base = 'organization/share'
1434
+ # uri_base = 'workspace/share'
1431
1435
  if entitytype == "site":
1432
- uri_base = "organization/site"
1436
+ uri_base = "workspace/site"
1433
1437
  elif entitytype == "queue":
1434
1438
  uri_base = "job"
1435
1439
  elif entitytype == "task":
@@ -1509,6 +1513,6 @@ class Session(object):
1509
1513
  return binascii.b2a_base64(s)
1510
1514
 
1511
1515
 
1512
- class accsynException(Exception):
1516
+ class AccsynException(Exception):
1513
1517
  def __init__(self, message):
1514
- super(accsynException, self).__init__(message)
1518
+ super(AccsynException, self).__init__(message)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: accsyn-python-api
3
- Version: 3.0.0
3
+ Version: 3.0.2
4
4
  Summary: A Python API for accsyn programmable fast and secure data delivery software
5
5
  Home-page: https://github.com/accsyn/accsyn-python-api.git
6
6
  Author: Henrik Norin
@@ -1 +0,0 @@
1
- *.pyc