pyPreservica 3.0.6__py3-none-any.whl → 3.1.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.

Potentially problematic release.


This version of pyPreservica might be problematic. Click here for more details.

pyPreservica/__init__.py CHANGED
@@ -34,6 +34,6 @@ from .mdformsAPI import MetadataGroupsAPI, Group, GroupField, GroupFieldType
34
34
  __author__ = "James Carr (drjamescarr@gmail.com)"
35
35
 
36
36
  # Version of the pyPreservica package
37
- __version__ = "3.0.6"
37
+ __version__ = "3.1.1"
38
38
 
39
39
  __license__ = "Apache License Version 2.0"
pyPreservica/common.py CHANGED
@@ -853,6 +853,7 @@ class AuthenticatedAPI:
853
853
  if self.tenant is None:
854
854
  self.tenant = response.json()['tenant']
855
855
  if self.two_fa_secret_key:
856
+ logger.debug("Found Two Factor Token")
856
857
  totp = pyotp.TOTP(self.two_fa_secret_key)
857
858
  data = {'username': self.username,
858
859
  'continuationToken': response.json()['continuationToken'],
@@ -865,8 +866,8 @@ class AuthenticatedAPI:
865
866
  else:
866
867
  msg = "Failed to create a 2FA authentication token. Check your credentials are correct"
867
868
  logger.error(msg)
868
- logger.error(str(response.content))
869
- raise RuntimeError(response.status_code, msg)
869
+ logger.error(str(response_2fa.content))
870
+ raise RuntimeError(response_2fa.status_code, msg)
870
871
  else:
871
872
  msg = "2FA twoFactorToken required to authenticate against this account using 2FA"
872
873
  logger.error(msg)
pyPreservica/entityAPI.py CHANGED
@@ -918,7 +918,7 @@ class EntityAPI(AuthenticatedAPI):
918
918
  content.append(tree.getroot())
919
919
  else:
920
920
  raise RuntimeError("Unknown data type")
921
- xml_request = xml.etree.ElementTree.tostring(xml_object, encoding='utf-8')
921
+ xml_request = xml.etree.ElementTree.tostring(xml_object, encoding='utf-8').decode("utf-8")
922
922
  logger.debug(xml_request)
923
923
  request = self.session.put(url, data=xml_request, headers=headers)
924
924
  if request.status_code == requests.codes.ok:
@@ -2126,9 +2126,15 @@ class EntityAPI(AuthenticatedAPI):
2126
2126
  actions = entity_response.findall(f'.//{{{self.xip_ns}}}EventAction')
2127
2127
  result_list = []
2128
2128
  for action in actions:
2129
- entity_ref = action.findall(f'.//{{{self.xip_ns}}}Entity')
2130
- for refs in entity_ref:
2131
- result_list.append(refs.text)
2129
+ item: dict = {}
2130
+ event = action.find(f'.//{{{self.xip_ns}}}Event')
2131
+ event_type = event.attrib["type"]
2132
+ item['EventType'] = event_type
2133
+ entity_date = action.find(f'.//{{{self.xip_ns}}}Date')
2134
+ item['Date'] = entity_date.text
2135
+ entity_ref = action.find(f'.//{{{self.xip_ns}}}Entity')
2136
+ item['Entity'] = entity_ref.text
2137
+ result_list.append(item)
2132
2138
  next_url = entity_response.find(f'.//{{{self.entity_ns}}}Next')
2133
2139
  total_hits = entity_response.find(f'.//{{{self.entity_ns}}}TotalResults')
2134
2140
  has_more = True
@@ -2162,6 +2168,9 @@ class EntityAPI(AuthenticatedAPI):
2162
2168
  params["from"] = kwargs.get("from_date")
2163
2169
  if "to_date" in kwargs:
2164
2170
  params["to"] = kwargs.get("to_date")
2171
+ if "username" in kwargs:
2172
+ params["username"] = kwargs.get("username")
2173
+
2165
2174
 
2166
2175
  if next_page is None:
2167
2176
  request = self.session.get(f'{self.protocol}://{self.server}/api/entity/events', params=params,
pyPreservica/uploadAPI.py CHANGED
@@ -911,17 +911,22 @@ def complex_asset_package(preservation_files_list=None, access_files_list=None,
911
911
  if has_preservation_files:
912
912
  if default_asset_title is None:
913
913
  default_asset_title = os.path.splitext(os.path.basename(preservation_files_list[0]))[0]
914
-
915
914
  # create the asset
916
- xip, io_ref = __create_io__(file_name=default_asset_title, parent_folder=parent_folder, **kwargs)
915
+ if io_ref is None:
916
+ xip, io_ref = __create_io__(file_name=default_asset_title, parent_folder=parent_folder, **kwargs)
917
917
 
918
918
  if has_access_files:
919
919
  if default_asset_title is None:
920
920
  default_asset_title = os.path.splitext(os.path.basename(access_files_list[0]))[0]
921
-
922
921
  if io_ref is None:
923
922
  xip, io_ref = __create_io__(file_name=default_asset_title, parent_folder=parent_folder, **kwargs)
924
923
 
924
+ if io_ref is None:
925
+ default_asset_title = kwargs.get('Title', None)
926
+ if default_asset_title is None:
927
+ default_asset_title = "New Asset"
928
+ xip, io_ref = __create_io__(file_name=default_asset_title, parent_folder=parent_folder, **kwargs)
929
+
925
930
  if has_preservation_files:
926
931
  # add the content objects
927
932
  representation_name = kwargs.get('Preservation_Representation_Name', "Preservation")
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: pyPreservica
3
- Version: 3.0.6
3
+ Version: 3.1.1
4
4
  Summary: Python library for the Preservica API
5
5
  Home-page: https://pypreservica.readthedocs.io/
6
6
  Author: James Carr
@@ -16,7 +16,6 @@ Classifier: Programming Language :: Python :: 3.9
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
- Classifier: License :: OSI Approved :: Apache Software License
20
19
  Classifier: Operating System :: OS Independent
21
20
  Classifier: Topic :: System :: Archiving
22
21
  Description-Content-Type: text/markdown
@@ -39,6 +38,7 @@ Dynamic: description-content-type
39
38
  Dynamic: home-page
40
39
  Dynamic: keywords
41
40
  Dynamic: license
41
+ Dynamic: license-file
42
42
  Dynamic: project-url
43
43
  Dynamic: requires-dist
44
44
  Dynamic: summary
@@ -1,19 +1,19 @@
1
- pyPreservica/__init__.py,sha256=b2cWepSUrTlRg-YBHg2Nue8zJHse-RXN7__aUmo9lLs,1212
1
+ pyPreservica/__init__.py,sha256=A3EpVn5oHQJjia8sh7D3Pzk6GlNPgrlpRL0VnDZn1f8,1212
2
2
  pyPreservica/adminAPI.py,sha256=aMN2twcUZOFoGx2yapC6GVtBTdYHUJFA-5bdWVkCwS8,37773
3
3
  pyPreservica/authorityAPI.py,sha256=jpf_m9i-IakyNVooi2yELuKt4yhX73hWqQNbPRHZx2g,9206
4
- pyPreservica/common.py,sha256=4V9cwtb5LGIaKvm6hYVk-u4QltM7BDg4qXyz2gXR9X4,38197
4
+ pyPreservica/common.py,sha256=iEeF4Kg51d4Vug-Dv8TeqS1lP2zcfM7YtBO8oANEcCU,38273
5
5
  pyPreservica/contentAPI.py,sha256=nOj7WciYARhLQWW65215Ghwz3CG61AVvikETPdtN4r0,22174
6
- pyPreservica/entityAPI.py,sha256=-XZCys4nZRFEL6w0EpCQBUwADbMTi7BzDwrRzIG5PZQ,123493
6
+ pyPreservica/entityAPI.py,sha256=p0u2OoLWOg1UxGq7ZRU__bz99FS5_nXW7wENufMgKNI,123919
7
7
  pyPreservica/mdformsAPI.py,sha256=_hBjT4-OzgLQGDfYX7b_01P27wc-RmsCEu57VtyAdh8,19173
8
8
  pyPreservica/monitorAPI.py,sha256=LJOUrynBOWKlNiYpZ1iH8qB1oIIuKX1Ms1SRBcuXohA,6274
9
9
  pyPreservica/opex.py,sha256=ccra1S4ojUXS3PlbU8WfxajOkJrwG4OykBnNrYP_jus,4875
10
10
  pyPreservica/parAPI.py,sha256=f0ZUxLd0U-BW6kBx5K7W2Pv7NjG3MkTNydmxQ3U1ZVE,9296
11
11
  pyPreservica/retentionAPI.py,sha256=QUTCbN4P3IpqmrebU_wd3n5ZVcyxVLTFAli8Y_GxOW4,24843
12
- pyPreservica/uploadAPI.py,sha256=icEwzu4-dDdMJ7tlnWKDGxMbqIcLqfj7DVw2QSFrSBY,99517
12
+ pyPreservica/uploadAPI.py,sha256=uX67mW-2q7FmjtXQ759GwHPL6Zs7R-iE8-86PBApvbY,99823
13
13
  pyPreservica/webHooksAPI.py,sha256=B3C6PV_3JLlJrr9PtsTzL-21M0msx8Mnj18Xb3Bv4RE,6814
14
14
  pyPreservica/workflowAPI.py,sha256=OcOiiUdrQerbPllrkj1lWpmuW0jTuyyV0urwPSYcd_U,17561
15
- pyPreservica-3.0.6.dist-info/LICENSE.txt,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
16
- pyPreservica-3.0.6.dist-info/METADATA,sha256=NI2dhIZ1issZztZyrDnXWD1W4ZzPOGWwHk1CNxxrP_A,3050
17
- pyPreservica-3.0.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
18
- pyPreservica-3.0.6.dist-info/top_level.txt,sha256=iIBh6NAznYQHOV8mv_y_kGKSDITek9rANyFDwJsbU-c,13
19
- pyPreservica-3.0.6.dist-info/RECORD,,
15
+ pypreservica-3.1.1.dist-info/licenses/LICENSE.txt,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
16
+ pypreservica-3.1.1.dist-info/METADATA,sha256=fWV7Yk9RUUDKhAGYJnkpf27fjbzwqFjqYN4NdB5-ZWI,3009
17
+ pypreservica-3.1.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
18
+ pypreservica-3.1.1.dist-info/top_level.txt,sha256=iIBh6NAznYQHOV8mv_y_kGKSDITek9rANyFDwJsbU-c,13
19
+ pypreservica-3.1.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5