pyPreservica 2.1.1__py3-none-any.whl → 2.2.0__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.
- pyPreservica/__init__.py +1 -1
- pyPreservica/common.py +1 -1
- pyPreservica/contentAPI.py +3 -1
- pyPreservica/entityAPI.py +9 -1
- pyPreservica/uploadAPI.py +44 -1
- {pyPreservica-2.1.1.dist-info → pyPreservica-2.2.0.dist-info}/METADATA +1 -1
- {pyPreservica-2.1.1.dist-info → pyPreservica-2.2.0.dist-info}/RECORD +10 -10
- {pyPreservica-2.1.1.dist-info → pyPreservica-2.2.0.dist-info}/LICENSE.txt +0 -0
- {pyPreservica-2.1.1.dist-info → pyPreservica-2.2.0.dist-info}/WHEEL +0 -0
- {pyPreservica-2.1.1.dist-info → pyPreservica-2.2.0.dist-info}/top_level.txt +0 -0
pyPreservica/__init__.py
CHANGED
pyPreservica/common.py
CHANGED
|
@@ -735,7 +735,7 @@ class AuthenticatedAPI:
|
|
|
735
735
|
RuntimeError(request.status_code, "version number failed")
|
|
736
736
|
|
|
737
737
|
def __str__(self):
|
|
738
|
-
return f"pyPreservica version: {pyPreservica.__version__} (Preservica 6.
|
|
738
|
+
return f"pyPreservica version: {pyPreservica.__version__} (Preservica 6.10 Compatible) " \
|
|
739
739
|
f"Connected to: {self.server} Preservica version: {self.version} as {self.username} " \
|
|
740
740
|
f"in tenancy {self.tenant}"
|
|
741
741
|
|
pyPreservica/contentAPI.py
CHANGED
|
@@ -271,6 +271,9 @@ class ContentAPI(AuthenticatedAPI):
|
|
|
271
271
|
start_from = str(start_index)
|
|
272
272
|
headers = {'Content-Type': 'application/x-www-form-urlencoded', HEADER_TOKEN: self.token}
|
|
273
273
|
|
|
274
|
+
if filter_values is None:
|
|
275
|
+
filter_values = {}
|
|
276
|
+
|
|
274
277
|
field_list = []
|
|
275
278
|
for key, value in filter_values.items():
|
|
276
279
|
if value == "":
|
|
@@ -293,7 +296,6 @@ class ContentAPI(AuthenticatedAPI):
|
|
|
293
296
|
query_term = ('{ "q": "%s", "fields": [ %s ], "sort": [ %s ]}' % (query, filter_terms, sort_terms))
|
|
294
297
|
|
|
295
298
|
payload = {'start': start_from, 'max': str(page_size), 'metadata': list(filter_values.keys()), 'q': query_term}
|
|
296
|
-
print(payload)
|
|
297
299
|
logger.debug(payload)
|
|
298
300
|
results = self.session.post(f'{self.protocol}://{self.server}/api/content/search', data=payload,
|
|
299
301
|
headers=headers)
|
pyPreservica/entityAPI.py
CHANGED
|
@@ -8,6 +8,7 @@ author: James Carr
|
|
|
8
8
|
licence: Apache License 2.0
|
|
9
9
|
|
|
10
10
|
"""
|
|
11
|
+
import hashlib
|
|
11
12
|
import uuid
|
|
12
13
|
import xml.etree.ElementTree
|
|
13
14
|
from datetime import datetime, timedelta, timezone
|
|
@@ -1540,7 +1541,14 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
1540
1541
|
bitstream = generation.bitstreams.pop()
|
|
1541
1542
|
for algo, value in bitstream.fixity.items():
|
|
1542
1543
|
fixity_algorithm = algo
|
|
1543
|
-
|
|
1544
|
+
if "MD5" in fixity_algorithm.upper():
|
|
1545
|
+
fixity_value = FileHash(hashlib.md5)
|
|
1546
|
+
if "SHA1" in fixity_algorithm.upper() or "SHA-1" in fixity_algorithm.upper():
|
|
1547
|
+
fixity_value = FileHash(hashlib.sha1)
|
|
1548
|
+
if "SHA256" in fixity_algorithm.upper() or "SHA-256" in fixity_algorithm.upper():
|
|
1549
|
+
fixity_value = FileHash(hashlib.sha256)
|
|
1550
|
+
if "SHA512" in fixity_algorithm.upper() or "SHA-512" in fixity_algorithm.upper():
|
|
1551
|
+
fixity_value = FileHash(hashlib.sha512)
|
|
1544
1552
|
|
|
1545
1553
|
if fixity_algorithm and fixity_value:
|
|
1546
1554
|
if "MD5" in fixity_algorithm.upper():
|
pyPreservica/uploadAPI.py
CHANGED
|
@@ -1031,7 +1031,7 @@ def complex_asset_package(preservation_files_list=None, access_files_list=None,
|
|
|
1031
1031
|
metadata_map = kwargs.get('Asset_Metadata')
|
|
1032
1032
|
for metadata_ns, metadata_path in metadata_map.items():
|
|
1033
1033
|
if metadata_ns:
|
|
1034
|
-
if metadata_path:
|
|
1034
|
+
if metadata_path and isinstance(metadata_path, str):
|
|
1035
1035
|
if os.path.exists(metadata_path) and os.path.isfile(metadata_path):
|
|
1036
1036
|
descriptive_metadata = xml.etree.ElementTree.parse(source=metadata_path)
|
|
1037
1037
|
metadata = SubElement(xip, 'Metadata', {'schemaUri': metadata_ns})
|
|
@@ -1053,6 +1053,17 @@ def complex_asset_package(preservation_files_list=None, access_files_list=None,
|
|
|
1053
1053
|
content.append(descriptive_metadata)
|
|
1054
1054
|
except RuntimeError:
|
|
1055
1055
|
logging.info(f"Could not parse asset metadata in namespace {metadata_ns}")
|
|
1056
|
+
if metadata_path and isinstance(metadata_path, list):
|
|
1057
|
+
for path in metadata_path:
|
|
1058
|
+
if os.path.exists(path) and os.path.isfile(path):
|
|
1059
|
+
descriptive_metadata = xml.etree.ElementTree.parse(source=path)
|
|
1060
|
+
metadata = SubElement(xip, 'Metadata', {'schemaUri': metadata_ns})
|
|
1061
|
+
metadata_ref = SubElement(metadata, 'Ref')
|
|
1062
|
+
metadata_ref.text = str(uuid.uuid4())
|
|
1063
|
+
entity = SubElement(metadata, 'Entity')
|
|
1064
|
+
entity.text = io_ref
|
|
1065
|
+
content = SubElement(metadata, 'Content')
|
|
1066
|
+
content.append(descriptive_metadata.getroot())
|
|
1056
1067
|
|
|
1057
1068
|
if xip is not None:
|
|
1058
1069
|
export_folder = export_folder
|
|
@@ -1728,6 +1739,38 @@ class UploadAPI(AuthenticatedAPI):
|
|
|
1728
1739
|
logger.info(f"Reached Max Upload Limit")
|
|
1729
1740
|
break
|
|
1730
1741
|
|
|
1742
|
+
def upload_zip_to_Source(self, path_to_zip_package, container_name, folder=None, delete_after_upload=False,
|
|
1743
|
+
show_progress=False):
|
|
1744
|
+
|
|
1745
|
+
"""
|
|
1746
|
+
Uploads a zip file package to either an Azure container or S3 bucket
|
|
1747
|
+
depending on the Preservica system deployment
|
|
1748
|
+
|
|
1749
|
+
:param str path_to_zip_package: Path to the package
|
|
1750
|
+
:param str container_name: container connected to the ingest workflow
|
|
1751
|
+
:param Folder folder: The folder to ingest the package into
|
|
1752
|
+
:param bool delete_after_upload: Delete the local copy of the package after the upload has completed
|
|
1753
|
+
:param bool show_progress: Show upload progress bar
|
|
1754
|
+
|
|
1755
|
+
"""
|
|
1756
|
+
|
|
1757
|
+
locations = self.upload_locations()
|
|
1758
|
+
for location in locations:
|
|
1759
|
+
if location['containerName'] == container_name:
|
|
1760
|
+
if location['type'] == 'AWS':
|
|
1761
|
+
callback = None
|
|
1762
|
+
if show_progress:
|
|
1763
|
+
callback = UploadProgressConsoleCallback(path_to_zip_package)
|
|
1764
|
+
self.upload_zip_package_to_S3(path_to_zip_package=path_to_zip_package,
|
|
1765
|
+
bucket_name=container_name, folder=folder, callback=callback,
|
|
1766
|
+
delete_after_upload=delete_after_upload)
|
|
1767
|
+
else:
|
|
1768
|
+
self.upload_zip_package_to_Azure(path_to_zip_package=path_to_zip_package,
|
|
1769
|
+
container_name=container_name, folder=folder,
|
|
1770
|
+
delete_after_upload=delete_after_upload,
|
|
1771
|
+
show_progress=show_progress)
|
|
1772
|
+
|
|
1773
|
+
|
|
1731
1774
|
def upload_zip_package_to_Azure(self, path_to_zip_package, container_name, folder=None, delete_after_upload=False,
|
|
1732
1775
|
show_progress=False):
|
|
1733
1776
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
pyPreservica/__init__.py,sha256=
|
|
1
|
+
pyPreservica/__init__.py,sha256=1FEwPJXGofNTnpV2ypw2XRCPhHF3b8_Nyf1yEcvEj0s,1085
|
|
2
2
|
pyPreservica/adminAPI.py,sha256=HoiNw1eWKhyb2Ccr40GjjMRjxMQIfoPIWP3h3pQjm0E,37810
|
|
3
3
|
pyPreservica/authorityAPI.py,sha256=Eule8g6LXr8c8SFcJgpRah4lH1FgevUItO5HhHDEaZE,9172
|
|
4
|
-
pyPreservica/common.py,sha256=
|
|
5
|
-
pyPreservica/contentAPI.py,sha256=
|
|
6
|
-
pyPreservica/entityAPI.py,sha256=
|
|
4
|
+
pyPreservica/common.py,sha256=kEfrJAr7cTNG37ziYUW-lgA8b2Llw3UGvfMxOoz-jyQ,35346
|
|
5
|
+
pyPreservica/contentAPI.py,sha256=GZZsZYOf9uXQ7hdnvZldrQuXYrndkec21P-ACgn-Wus,17251
|
|
6
|
+
pyPreservica/entityAPI.py,sha256=rUwAOvbXi3x8L0xatNRtZjMXdbs8bzyjU2XOqlSw3hA,108985
|
|
7
7
|
pyPreservica/monitorAPI.py,sha256=Xto2uSiryfZlUMUCrH7it2B8xOPVSLgSVLodxZW45po,6258
|
|
8
8
|
pyPreservica/opex.py,sha256=ccra1S4ojUXS3PlbU8WfxajOkJrwG4OykBnNrYP_jus,4875
|
|
9
9
|
pyPreservica/parAPI.py,sha256=bgaQvYfWNnzdD7ibKMV3ZV85pNkEdSoLsgVigoiFFfw,10771
|
|
10
10
|
pyPreservica/retentionAPI.py,sha256=Cx1ofz9V31a8c8utEfKYLlfQaHSaaqg_D4R3LUFBEx0,23612
|
|
11
|
-
pyPreservica/uploadAPI.py,sha256=
|
|
11
|
+
pyPreservica/uploadAPI.py,sha256=HdMoQAq2PY6NQklrYb2l51YoPyTXc71__dXhqsuNP0A,95157
|
|
12
12
|
pyPreservica/vocabularyAPI.py,sha256=jPl6KDZoBGqlY0oEYjTpZ9kNEPzchDW-gyp-HH-MSKk,5729
|
|
13
13
|
pyPreservica/webHooksAPI.py,sha256=bhenk2nAlAZRauSET0AG9DZyKckJos2NENyl0LDN5Z4,6736
|
|
14
14
|
pyPreservica/workflowAPI.py,sha256=QOMd4Nw69Vf8tJ7Px4gSLpug7VakAtNi-90UTgWSed0,17862
|
|
15
|
-
pyPreservica-2.
|
|
16
|
-
pyPreservica-2.
|
|
17
|
-
pyPreservica-2.
|
|
18
|
-
pyPreservica-2.
|
|
19
|
-
pyPreservica-2.
|
|
15
|
+
pyPreservica-2.2.0.dist-info/LICENSE.txt,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
16
|
+
pyPreservica-2.2.0.dist-info/METADATA,sha256=r_QoMld1uBWoXYMw5CdNs-c3r6ZoWYGNJpRtzsYKLCA,2784
|
|
17
|
+
pyPreservica-2.2.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
18
|
+
pyPreservica-2.2.0.dist-info/top_level.txt,sha256=iIBh6NAznYQHOV8mv_y_kGKSDITek9rANyFDwJsbU-c,13
|
|
19
|
+
pyPreservica-2.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|