pyPreservica 2.2.1__tar.gz → 2.3.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.
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/PKG-INFO +1 -1
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/__init__.py +1 -1
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/entityAPI.py +30 -1
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/uploadAPI.py +8 -3
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica.egg-info/PKG-INFO +1 -1
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/setup.py +1 -1
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/LICENSE.txt +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/README.md +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/adminAPI.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/authorityAPI.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/common.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/contentAPI.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/monitorAPI.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/opex.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/parAPI.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/retentionAPI.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/webHooksAPI.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica/workflowAPI.py +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica.egg-info/SOURCES.txt +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica.egg-info/dependency_links.txt +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica.egg-info/requires.txt +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/pyPreservica.egg-info/top_level.txt +0 -0
- {pyPreservica-2.2.1 → pyPreservica-2.3.1}/setup.cfg +0 -0
|
@@ -9,6 +9,7 @@ licence: Apache License 2.0
|
|
|
9
9
|
|
|
10
10
|
"""
|
|
11
11
|
import hashlib
|
|
12
|
+
import os.path
|
|
12
13
|
import uuid
|
|
13
14
|
import xml.etree.ElementTree
|
|
14
15
|
from datetime import datetime, timedelta, timezone
|
|
@@ -1694,6 +1695,34 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
1694
1695
|
logger.error(exception)
|
|
1695
1696
|
raise exception
|
|
1696
1697
|
|
|
1698
|
+
def add_access_representation(self, entity: Entity, access_file: str, name: str = "Access"):
|
|
1699
|
+
"""
|
|
1700
|
+
Add a new representation to an existing asset.
|
|
1701
|
+
|
|
1702
|
+
:param entity: The existing asset which will receive the new representation
|
|
1703
|
+
:param access_file: The new digital file
|
|
1704
|
+
:param name: The name of the new access representation defaults to "Access"
|
|
1705
|
+
:return:
|
|
1706
|
+
"""
|
|
1707
|
+
|
|
1708
|
+
if self.major_version < 7 and self.minor_version < 12:
|
|
1709
|
+
raise RuntimeError("Add Representation API is only available when connected to a v6.12 System")
|
|
1710
|
+
|
|
1711
|
+
if isinstance(entity, Folder) or isinstance(entity, ContentObject):
|
|
1712
|
+
raise RuntimeError("Add Representation cannot be added to Folders and Content Objects")
|
|
1713
|
+
|
|
1714
|
+
headers = {HEADER_TOKEN: self.token, 'Content-Type': 'application/octet-stream'}
|
|
1715
|
+
|
|
1716
|
+
filename = os.path.basename(access_file)
|
|
1717
|
+
|
|
1718
|
+
params = {'type': 'Access', 'name': name, 'filename': filename}
|
|
1719
|
+
|
|
1720
|
+
with open(access_file, 'rb') as fd:
|
|
1721
|
+
request = self.session.post(
|
|
1722
|
+
f'{self.protocol}://{self.server}/api/entity/{entity.path}/{entity.reference}/representations',
|
|
1723
|
+
data=fd, headers=headers, params=params)
|
|
1724
|
+
|
|
1725
|
+
|
|
1697
1726
|
def add_thumbnail(self, entity: Entity, image_file: str):
|
|
1698
1727
|
"""
|
|
1699
1728
|
add a thumbnail icon to a folder or asset
|
|
@@ -1708,7 +1737,7 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
1708
1737
|
if isinstance(entity, ContentObject):
|
|
1709
1738
|
raise RuntimeError("Thumbnails cannot be added to Content Objects")
|
|
1710
1739
|
|
|
1711
|
-
headers = {HEADER_TOKEN: self.token,
|
|
1740
|
+
headers = {HEADER_TOKEN: self.token, 'Content-Type': 'application/octet-stream'}
|
|
1712
1741
|
|
|
1713
1742
|
with open(image_file, 'rb') as fd:
|
|
1714
1743
|
request = self.session.put(
|
|
@@ -1662,9 +1662,9 @@ class UploadAPI(AuthenticatedAPI):
|
|
|
1662
1662
|
"""
|
|
1663
1663
|
return self.upload_locations()
|
|
1664
1664
|
|
|
1665
|
-
def crawl_filesystem(self, filesystem_path, bucket_name, preservica_parent, callback=
|
|
1665
|
+
def crawl_filesystem(self, filesystem_path, bucket_name, preservica_parent, callback: bool = False,
|
|
1666
1666
|
security_tag: str = "open",
|
|
1667
|
-
delete_after_upload=True, max_MB_ingested: int = -1):
|
|
1667
|
+
delete_after_upload: bool = True, max_MB_ingested: int = -1):
|
|
1668
1668
|
|
|
1669
1669
|
def get_parent(client, identifier, parent_reference):
|
|
1670
1670
|
id = str(os.path.dirname(identifier))
|
|
@@ -1730,8 +1730,13 @@ class UploadAPI(AuthenticatedAPI):
|
|
|
1730
1730
|
full_path_list = [os.path.join(dirname, file) for file in files]
|
|
1731
1731
|
package = multi_asset_package(asset_file_list=full_path_list, parent_folder=f, SecurityTag=security_tag,
|
|
1732
1732
|
Identifiers=identifiers)
|
|
1733
|
+
if callback:
|
|
1734
|
+
progress_display = UploadProgressConsoleCallback(package)
|
|
1735
|
+
else:
|
|
1736
|
+
progress_display = None
|
|
1737
|
+
|
|
1733
1738
|
self.upload_zip_package_to_S3(path_to_zip_package=package, bucket_name=bucket_name,
|
|
1734
|
-
callback=
|
|
1739
|
+
callback=progress_display, delete_after_upload=delete_after_upload)
|
|
1735
1740
|
logger.info(f"Uploaded " + "{:.1f}".format(bytes_ingested / (1024 * 1024)) + " MB")
|
|
1736
1741
|
|
|
1737
1742
|
if max_MB_ingested > 0:
|
|
@@ -21,7 +21,7 @@ if sys.argv[-1] == 'publish':
|
|
|
21
21
|
# This call to setup() does all the work
|
|
22
22
|
setup(
|
|
23
23
|
name=PKG,
|
|
24
|
-
version="2.
|
|
24
|
+
version="2.3.1",
|
|
25
25
|
description="Python library for the Preservica API",
|
|
26
26
|
long_description=README,
|
|
27
27
|
long_description_content_type="text/markdown",
|
|
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
|