pyPreservica 3.2.1__py3-none-any.whl → 3.2.2__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 +1 -1
- pyPreservica/common.py +4 -0
- pyPreservica/entityAPI.py +37 -7
- {pypreservica-3.2.1.dist-info → pypreservica-3.2.2.dist-info}/METADATA +4 -3
- {pypreservica-3.2.1.dist-info → pypreservica-3.2.2.dist-info}/RECORD +8 -8
- {pypreservica-3.2.1.dist-info → pypreservica-3.2.2.dist-info}/WHEEL +0 -0
- {pypreservica-3.2.1.dist-info → pypreservica-3.2.2.dist-info}/licenses/LICENSE.txt +0 -0
- {pypreservica-3.2.1.dist-info → pypreservica-3.2.2.dist-info}/top_level.txt +0 -0
pyPreservica/__init__.py
CHANGED
pyPreservica/common.py
CHANGED
|
@@ -816,6 +816,10 @@ class AuthenticatedAPI:
|
|
|
816
816
|
self.major_version = int(version_numbers[0])
|
|
817
817
|
self.minor_version = int(version_numbers[1])
|
|
818
818
|
self.patch_version = int(version_numbers[2])
|
|
819
|
+
|
|
820
|
+
if self.server == "preview.preservica.com":
|
|
821
|
+
self.minor_version = 1
|
|
822
|
+
|
|
819
823
|
return version
|
|
820
824
|
elif request.status_code == requests.codes.unauthorized:
|
|
821
825
|
self.token = self.__token__()
|
pyPreservica/entityAPI.py
CHANGED
|
@@ -149,7 +149,6 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
149
149
|
|
|
150
150
|
return storage_locations
|
|
151
151
|
|
|
152
|
-
|
|
153
152
|
def bitstream_content(self, bitstream: Bitstream, filename: str, chunk_size: int = CHUNK_SIZE) -> Union[int, None]:
|
|
154
153
|
"""
|
|
155
154
|
Download a file represented as a Bitstream to a local filename
|
|
@@ -534,7 +533,6 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
534
533
|
logger.error(exception)
|
|
535
534
|
raise exception
|
|
536
535
|
|
|
537
|
-
|
|
538
536
|
def identifiers_for_entity(self, entity: Entity) -> set[Tuple]:
|
|
539
537
|
"""
|
|
540
538
|
Get all external identifiers on an entity
|
|
@@ -572,8 +570,6 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
572
570
|
logger.error(exception)
|
|
573
571
|
raise exception
|
|
574
572
|
|
|
575
|
-
|
|
576
|
-
|
|
577
573
|
def identifier(self, identifier_type: str, identifier_value: str) -> set[EntityT]:
|
|
578
574
|
"""
|
|
579
575
|
Get all entities which have the external identifier
|
|
@@ -1158,7 +1154,6 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
1158
1154
|
def get_progress(self, pid: str) -> AsyncProgress:
|
|
1159
1155
|
return AsyncProgress[self.get_async_progress(pid)]
|
|
1160
1156
|
|
|
1161
|
-
|
|
1162
1157
|
def get_async_progress(self, pid: str) -> str:
|
|
1163
1158
|
headers = {HEADER_TOKEN: self.token, 'Content-Type': 'text/plain'}
|
|
1164
1159
|
request = self.session.get(f"{self.protocol}://{self.server}/api/entity/progress/{pid}", headers=headers)
|
|
@@ -1465,6 +1460,42 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
1465
1460
|
logger.error(exception)
|
|
1466
1461
|
raise exception
|
|
1467
1462
|
|
|
1463
|
+
def merge_folder(self, folder: Folder)-> str:
|
|
1464
|
+
"""
|
|
1465
|
+
Create a new Asset with the content from each Asset in the Folder
|
|
1466
|
+
|
|
1467
|
+
This call will create a new multi-part Asset which contains all the content from the Folder.
|
|
1468
|
+
|
|
1469
|
+
The new Asset which is created will have the same title, description and parent as the Folder.
|
|
1470
|
+
|
|
1471
|
+
The return value is the progress status of the merge operation.
|
|
1472
|
+
"""
|
|
1473
|
+
headers = {HEADER_TOKEN: self.token, 'Content-Type': 'application/xml;charset=UTF-8', 'accept': 'text/plain;charset=UTF-8'}
|
|
1474
|
+
payload = f"""<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1475
|
+
<MergeAction xmlns="{self.entity_ns}" xmlns:xip="{self.xip_ns}">
|
|
1476
|
+
<Title>{folder.title}</Title>
|
|
1477
|
+
<Description>{folder.description}</Description>
|
|
1478
|
+
<Entity excludeIdentifiers="true" excludeLinks="true" excludeMetadata="true" ref="{folder.reference}" type="SO"/>
|
|
1479
|
+
</MergeAction>"""
|
|
1480
|
+
request = self.session.post(
|
|
1481
|
+
f"{self.protocol}://{self.server}/api/entity/actions/merges", data=payload, headers=headers)
|
|
1482
|
+
if request.status_code == requests.codes.accepted:
|
|
1483
|
+
return request.content.decode('utf-8')
|
|
1484
|
+
elif request.status_code == requests.codes.unauthorized:
|
|
1485
|
+
self.token = self.__token__()
|
|
1486
|
+
return self.merge_folder(folder)
|
|
1487
|
+
else:
|
|
1488
|
+
exception = HTTPException(
|
|
1489
|
+
folder.reference,
|
|
1490
|
+
request.status_code,
|
|
1491
|
+
request.url,
|
|
1492
|
+
"merge_folder",
|
|
1493
|
+
request.content.decode("utf-8"),
|
|
1494
|
+
)
|
|
1495
|
+
logger.error(exception)
|
|
1496
|
+
raise exception
|
|
1497
|
+
|
|
1498
|
+
|
|
1468
1499
|
def asset(self, reference: str) -> Asset:
|
|
1469
1500
|
"""
|
|
1470
1501
|
Retrieve an Asset by its reference
|
|
@@ -2258,7 +2289,6 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
2258
2289
|
if "username" in kwargs:
|
|
2259
2290
|
params["username"] = kwargs.get("username")
|
|
2260
2291
|
|
|
2261
|
-
|
|
2262
2292
|
if next_page is None:
|
|
2263
2293
|
request = self.session.get(f'{self.protocol}://{self.server}/api/entity/events', params=params,
|
|
2264
2294
|
headers=headers)
|
|
@@ -2561,4 +2591,4 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
2561
2591
|
exception = HTTPException(entity.reference, request.status_code, request.url,
|
|
2562
2592
|
"_delete_entity", request.content.decode('utf-8'))
|
|
2563
2593
|
logger.error(exception)
|
|
2564
|
-
raise exception
|
|
2594
|
+
raise exception
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyPreservica
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.2
|
|
4
4
|
Summary: Python library for the Preservica API
|
|
5
5
|
Home-page: https://pypreservica.readthedocs.io/
|
|
6
6
|
Author: James Carr
|
|
@@ -16,6 +16,7 @@ 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: Programming Language :: Python :: 3.13
|
|
19
20
|
Classifier: Operating System :: OS Independent
|
|
20
21
|
Classifier: Topic :: System :: Archiving
|
|
21
22
|
Description-Content-Type: text/markdown
|
|
@@ -23,8 +24,8 @@ License-File: LICENSE.txt
|
|
|
23
24
|
Requires-Dist: requests
|
|
24
25
|
Requires-Dist: urllib3
|
|
25
26
|
Requires-Dist: certifi
|
|
26
|
-
Requires-Dist: boto3>=1.
|
|
27
|
-
Requires-Dist: botocore>=1.
|
|
27
|
+
Requires-Dist: boto3>=1.38.0
|
|
28
|
+
Requires-Dist: botocore>=1.38.0
|
|
28
29
|
Requires-Dist: s3transfer
|
|
29
30
|
Requires-Dist: azure-storage-blob
|
|
30
31
|
Requires-Dist: tqdm
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
pyPreservica/__init__.py,sha256=
|
|
1
|
+
pyPreservica/__init__.py,sha256=tLUJ6UX2RCmqbq_evT5ZlorC4T9sI7Opv83-E7Rvzj4,1250
|
|
2
2
|
pyPreservica/adminAPI.py,sha256=aMN2twcUZOFoGx2yapC6GVtBTdYHUJFA-5bdWVkCwS8,37773
|
|
3
3
|
pyPreservica/authorityAPI.py,sha256=jpf_m9i-IakyNVooi2yELuKt4yhX73hWqQNbPRHZx2g,9206
|
|
4
|
-
pyPreservica/common.py,sha256=
|
|
4
|
+
pyPreservica/common.py,sha256=CLfHI0Fec_wp1zngqw7-iIl2Yp3hG0ohjuhdl-K84hU,39030
|
|
5
5
|
pyPreservica/contentAPI.py,sha256=ZvX2aGQEaksmw-m-oEUI6daVSqFe_IcE1cGwCNbSCDQ,22286
|
|
6
|
-
pyPreservica/entityAPI.py,sha256=
|
|
6
|
+
pyPreservica/entityAPI.py,sha256=mELG2TxnFBCuDtsrZ2eRNc8EF-D6dI-dumzTfK976TQ,129974
|
|
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
|
|
@@ -13,8 +13,8 @@ pyPreservica/settingsAPI.py,sha256=jXnMOCq3mimta6E-Os3J1I1if2pYsjLpOazAx8L-ZQI,1
|
|
|
13
13
|
pyPreservica/uploadAPI.py,sha256=uX67mW-2q7FmjtXQ759GwHPL6Zs7R-iE8-86PBApvbY,99823
|
|
14
14
|
pyPreservica/webHooksAPI.py,sha256=B3C6PV_3JLlJrr9PtsTzL-21M0msx8Mnj18Xb3Bv4RE,6814
|
|
15
15
|
pyPreservica/workflowAPI.py,sha256=OcOiiUdrQerbPllrkj1lWpmuW0jTuyyV0urwPSYcd_U,17561
|
|
16
|
-
pypreservica-3.2.
|
|
17
|
-
pypreservica-3.2.
|
|
18
|
-
pypreservica-3.2.
|
|
19
|
-
pypreservica-3.2.
|
|
20
|
-
pypreservica-3.2.
|
|
16
|
+
pypreservica-3.2.2.dist-info/licenses/LICENSE.txt,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
17
|
+
pypreservica-3.2.2.dist-info/METADATA,sha256=_sr1wxUFF5oIuFQB6A90sDUAw88cWb11jhQ-kJGSBrk,3077
|
|
18
|
+
pypreservica-3.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
19
|
+
pypreservica-3.2.2.dist-info/top_level.txt,sha256=iIBh6NAznYQHOV8mv_y_kGKSDITek9rANyFDwJsbU-c,13
|
|
20
|
+
pypreservica-3.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|