pyPreservica 2.6.5__py3-none-any.whl → 2.7.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/adminAPI.py +10 -10
- pyPreservica/common.py +25 -24
- pyPreservica/entityAPI.py +6 -2
- pyPreservica/monitorAPI.py +1 -1
- pyPreservica/workflowAPI.py +4 -24
- {pyPreservica-2.6.5.dist-info → pyPreservica-2.7.0.dist-info}/METADATA +1 -1
- pyPreservica-2.7.0.dist-info/RECORD +19 -0
- pyPreservica-2.6.5.dist-info/RECORD +0 -19
- {pyPreservica-2.6.5.dist-info → pyPreservica-2.7.0.dist-info}/LICENSE.txt +0 -0
- {pyPreservica-2.6.5.dist-info → pyPreservica-2.7.0.dist-info}/WHEEL +0 -0
- {pyPreservica-2.6.5.dist-info → pyPreservica-2.7.0.dist-info}/top_level.txt +0 -0
pyPreservica/__init__.py
CHANGED
pyPreservica/adminAPI.py
CHANGED
|
@@ -373,16 +373,16 @@ class AdminAPI(AuthenticatedAPI):
|
|
|
373
373
|
self._check_if_user_has_manager_role()
|
|
374
374
|
return self._account_status_(username, "false", "disable_user")
|
|
375
375
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
376
|
+
def enable_user(self, username):
|
|
377
|
+
"""
|
|
378
|
+
Enable a Preservica User
|
|
379
|
+
|
|
380
|
+
:param username: email address of the preservica user
|
|
381
|
+
:type username: str
|
|
382
|
+
|
|
383
|
+
"""
|
|
384
|
+
self._check_if_user_has_manager_role()
|
|
385
|
+
return self._account_status_(username, "true", "enable_user")
|
|
386
386
|
|
|
387
387
|
def user_report(self, report_name="users.csv"):
|
|
388
388
|
"""
|
pyPreservica/common.py
CHANGED
|
@@ -23,6 +23,7 @@ import xml.etree.ElementTree
|
|
|
23
23
|
from enum import Enum
|
|
24
24
|
from pathlib import Path
|
|
25
25
|
import pyotp
|
|
26
|
+
from requests import Response, Session
|
|
26
27
|
from urllib3.util import Retry
|
|
27
28
|
import requests
|
|
28
29
|
from requests.adapters import HTTPAdapter
|
|
@@ -406,10 +407,11 @@ class Bitstream:
|
|
|
406
407
|
self.content_url = content_url
|
|
407
408
|
|
|
408
409
|
def __str__(self):
|
|
409
|
-
return f"
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
410
|
+
return f"""
|
|
411
|
+
Filename: {self.filename}
|
|
412
|
+
File Length: {self.length}
|
|
413
|
+
Fixity: {self.fixity}
|
|
414
|
+
"""
|
|
413
415
|
|
|
414
416
|
def __repr__(self):
|
|
415
417
|
return self.__str__()
|
|
@@ -431,11 +433,14 @@ class Generation:
|
|
|
431
433
|
self.formats = list()
|
|
432
434
|
|
|
433
435
|
def __str__(self):
|
|
434
|
-
return f"
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
436
|
+
return f"""
|
|
437
|
+
Active: {self.active}
|
|
438
|
+
Original: {self.original}
|
|
439
|
+
Format Group: {self.format_group}
|
|
440
|
+
Effective Date: {self.effective_date}
|
|
441
|
+
Formats: {self.formats}
|
|
442
|
+
Properties: {self.properties}
|
|
443
|
+
"""
|
|
439
444
|
|
|
440
445
|
def __repr__(self):
|
|
441
446
|
return self.__str__()
|
|
@@ -459,19 +464,15 @@ class Entity:
|
|
|
459
464
|
self.custom_type = None
|
|
460
465
|
|
|
461
466
|
def __str__(self):
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
f"Description:\t{self.description}\n" \
|
|
472
|
-
f"Security Tag:\t{self.security_tag}\n" \
|
|
473
|
-
f"Parent:\t\t\t{self.parent}\n" \
|
|
474
|
-
f"Type:\t\t\t{self.custom_type}\n\n"
|
|
467
|
+
return f"""
|
|
468
|
+
Entity: {self.entity_type}
|
|
469
|
+
Entity Ref: {self.reference}
|
|
470
|
+
Title: {self.title}
|
|
471
|
+
Description: {self.description}
|
|
472
|
+
Security Tag: {self.security_tag}
|
|
473
|
+
Parent: {self.parent}
|
|
474
|
+
Custom Type: {self.custom_type}
|
|
475
|
+
"""
|
|
475
476
|
|
|
476
477
|
def __repr__(self):
|
|
477
478
|
return self.__str__()
|
|
@@ -860,7 +861,7 @@ class AuthenticatedAPI:
|
|
|
860
861
|
|
|
861
862
|
config = configparser.ConfigParser(interpolation=configparser.Interpolation())
|
|
862
863
|
config.read('credentials.properties', encoding='utf-8')
|
|
863
|
-
self.session = requests.Session()
|
|
864
|
+
self.session: Session = requests.Session()
|
|
864
865
|
|
|
865
866
|
retries = Retry(
|
|
866
867
|
total=3,
|
|
@@ -869,7 +870,7 @@ class AuthenticatedAPI:
|
|
|
869
870
|
allowed_methods=Retry.DEFAULT_ALLOWED_METHODS
|
|
870
871
|
)
|
|
871
872
|
|
|
872
|
-
self.shared_secret = bool(use_shared_secret)
|
|
873
|
+
self.shared_secret: bool = bool(use_shared_secret)
|
|
873
874
|
self.protocol = protocol
|
|
874
875
|
self.two_fa_secret_key = two_fa_secret_key
|
|
875
876
|
|
pyPreservica/entityAPI.py
CHANGED
|
@@ -58,7 +58,7 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
58
58
|
|
|
59
59
|
:param bitstream: The bitstream
|
|
60
60
|
:param chunk_size: The chunk size to return
|
|
61
|
-
:return:
|
|
61
|
+
:return: A chunk of the requested bitstream content
|
|
62
62
|
"""
|
|
63
63
|
if not isinstance(bitstream, Bitstream):
|
|
64
64
|
logger.error("bitstream_content argument is not a Bitstream object")
|
|
@@ -1880,7 +1880,11 @@ class EntityAPI(AuthenticatedAPI):
|
|
|
1880
1880
|
def children(self, folder: Union[str, Folder] = None, maximum: int = 100, next_page: str = None) -> PagedSet:
|
|
1881
1881
|
headers = {HEADER_TOKEN: self.token}
|
|
1882
1882
|
data = {'start': str(0), 'max': str(maximum)}
|
|
1883
|
-
|
|
1883
|
+
|
|
1884
|
+
if isinstance(folder, Folder):
|
|
1885
|
+
folder_reference = folder.reference
|
|
1886
|
+
else:
|
|
1887
|
+
folder_reference = folder
|
|
1884
1888
|
if next_page is None:
|
|
1885
1889
|
if folder_reference is None:
|
|
1886
1890
|
request = self.session.get(f'{self.protocol}://{self.server}/api/entity/root/children', params=data,
|
pyPreservica/monitorAPI.py
CHANGED
|
@@ -108,7 +108,7 @@ class MonitorAPI(AuthenticatedAPI):
|
|
|
108
108
|
|
|
109
109
|
:param monitor_id: The Process ID
|
|
110
110
|
:type monitor_id: str
|
|
111
|
-
:return:
|
|
111
|
+
:return: List of timeseries information
|
|
112
112
|
"""
|
|
113
113
|
headers = {HEADER_TOKEN: self.token, 'Content-Type': 'application/json;charset=UTF-8'}
|
|
114
114
|
request = self.session.get(f'{self.protocol}://{self.server}/api/processmonitor/monitors/{monitor_id}/timeseries',
|
pyPreservica/workflowAPI.py
CHANGED
|
@@ -11,7 +11,6 @@ licence: Apache License 2.0
|
|
|
11
11
|
|
|
12
12
|
import uuid
|
|
13
13
|
import datetime
|
|
14
|
-
from xml.dom import minidom
|
|
15
14
|
from xml.etree import ElementTree
|
|
16
15
|
|
|
17
16
|
from pyPreservica.common import *
|
|
@@ -19,23 +18,10 @@ from pyPreservica.common import *
|
|
|
19
18
|
logger = logging.getLogger(__name__)
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
def prettify(elem):
|
|
23
|
-
"""Return a pretty-printed XML string for the Element.
|
|
24
|
-
"""
|
|
25
|
-
rough_string = ElementTree.tostring(elem, 'utf-8')
|
|
26
|
-
re_parsed = minidom.parseString(rough_string)
|
|
27
|
-
return re_parsed.toprettyxml(indent=" ")
|
|
28
|
-
|
|
29
|
-
|
|
30
21
|
class WorkflowInstance:
|
|
31
22
|
"""
|
|
32
23
|
Defines a workflow Instance.
|
|
33
24
|
The workflow Instance is context which has been executed
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
:param instance_id: The Workflow instance Id
|
|
37
|
-
:type instance_id: int
|
|
38
|
-
|
|
39
25
|
"""
|
|
40
26
|
|
|
41
27
|
def __init__(self, instance_id: int):
|
|
@@ -62,14 +48,6 @@ class WorkflowContext:
|
|
|
62
48
|
"""
|
|
63
49
|
Defines a workflow context.
|
|
64
50
|
The workflow context is the pre-defined workflow which is ready to run
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
:param workflow_name: The Workflow context name
|
|
68
|
-
:type workflow_name: str
|
|
69
|
-
|
|
70
|
-
:param workflow_id: The Workflow context id
|
|
71
|
-
:type workflow_id: str
|
|
72
|
-
|
|
73
51
|
"""
|
|
74
52
|
|
|
75
53
|
def __init__(self, workflow_id, workflow_name: str):
|
|
@@ -77,8 +55,10 @@ class WorkflowContext:
|
|
|
77
55
|
self.workflow_name = workflow_name
|
|
78
56
|
|
|
79
57
|
def __str__(self):
|
|
80
|
-
return f"
|
|
81
|
-
|
|
58
|
+
return f"""
|
|
59
|
+
Workflow ID: {self.workflow_id}
|
|
60
|
+
Workflow Name: {self.workflow_name}
|
|
61
|
+
"""
|
|
82
62
|
|
|
83
63
|
def __repr__(self):
|
|
84
64
|
return self.__str__()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
pyPreservica/__init__.py,sha256=9CnLUpMumnbIHfqhA4Y1riWp7PJbD_1gMy1sIuNaU5k,1085
|
|
2
|
+
pyPreservica/adminAPI.py,sha256=511bc5KtrCAXbDyBk39dmDnxUVDaOu6xaiyu0jYhxa4,37781
|
|
3
|
+
pyPreservica/authorityAPI.py,sha256=Eule8g6LXr8c8SFcJgpRah4lH1FgevUItO5HhHDEaZE,9172
|
|
4
|
+
pyPreservica/common.py,sha256=upTmwvPK9kcgSO3L8mfIMVrCOWJCCYIHi5GK516jOok,36518
|
|
5
|
+
pyPreservica/contentAPI.py,sha256=d6bK7qXFLep8rOs8y-dJGzoFuqanO3fo82G4dW0YWWE,17245
|
|
6
|
+
pyPreservica/entityAPI.py,sha256=adJFoPE1tfL_K8dE9kfWZMYdnMFtAMv8X6ZUQGxpQRA,114636
|
|
7
|
+
pyPreservica/monitorAPI.py,sha256=HD-PUPdSI9wGAa07e2_2_-FLINH8PoWUwpFogz7F-j4,6269
|
|
8
|
+
pyPreservica/opex.py,sha256=ccra1S4ojUXS3PlbU8WfxajOkJrwG4OykBnNrYP_jus,4875
|
|
9
|
+
pyPreservica/parAPI.py,sha256=bgaQvYfWNnzdD7ibKMV3ZV85pNkEdSoLsgVigoiFFfw,10771
|
|
10
|
+
pyPreservica/retentionAPI.py,sha256=Cx1ofz9V31a8c8utEfKYLlfQaHSaaqg_D4R3LUFBEx0,23612
|
|
11
|
+
pyPreservica/uploadAPI.py,sha256=4Rdm9xvO2FKC8SirOP41g5wVnPEZLRI0Mz4KinxT-L4,93553
|
|
12
|
+
pyPreservica/vocabularyAPI.py,sha256=jPl6KDZoBGqlY0oEYjTpZ9kNEPzchDW-gyp-HH-MSKk,5729
|
|
13
|
+
pyPreservica/webHooksAPI.py,sha256=0wP-59mep8gtlIZ9P5vV68-HnNdTuuo2kzGcDWj0bNg,6790
|
|
14
|
+
pyPreservica/workflowAPI.py,sha256=ENFWxcuPW5WX9jG2CAha6UzTywULWvosgTUVsmvs8f8,17323
|
|
15
|
+
pyPreservica-2.7.0.dist-info/LICENSE.txt,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
16
|
+
pyPreservica-2.7.0.dist-info/METADATA,sha256=G8cCrLf_qnlYZ2ujMTM3edGsjxaVyoAdv3H8QiHUa4A,2784
|
|
17
|
+
pyPreservica-2.7.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
18
|
+
pyPreservica-2.7.0.dist-info/top_level.txt,sha256=iIBh6NAznYQHOV8mv_y_kGKSDITek9rANyFDwJsbU-c,13
|
|
19
|
+
pyPreservica-2.7.0.dist-info/RECORD,,
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
pyPreservica/__init__.py,sha256=xaxuBRyqBz0HqppYSxn2b4Qfu0eapAeK9_hd5ueUbBQ,1085
|
|
2
|
-
pyPreservica/adminAPI.py,sha256=HoiNw1eWKhyb2Ccr40GjjMRjxMQIfoPIWP3h3pQjm0E,37810
|
|
3
|
-
pyPreservica/authorityAPI.py,sha256=Eule8g6LXr8c8SFcJgpRah4lH1FgevUItO5HhHDEaZE,9172
|
|
4
|
-
pyPreservica/common.py,sha256=EUGur629HxdYURuEKO5PoymJHIRvzp7J6EPTCGxDLTY,36777
|
|
5
|
-
pyPreservica/contentAPI.py,sha256=d6bK7qXFLep8rOs8y-dJGzoFuqanO3fo82G4dW0YWWE,17245
|
|
6
|
-
pyPreservica/entityAPI.py,sha256=C-OeanPz_v1MA-Y7rrER0U4XN5BZBgYPNHSWLsv-bWw,114472
|
|
7
|
-
pyPreservica/monitorAPI.py,sha256=Xto2uSiryfZlUMUCrH7it2B8xOPVSLgSVLodxZW45po,6258
|
|
8
|
-
pyPreservica/opex.py,sha256=ccra1S4ojUXS3PlbU8WfxajOkJrwG4OykBnNrYP_jus,4875
|
|
9
|
-
pyPreservica/parAPI.py,sha256=bgaQvYfWNnzdD7ibKMV3ZV85pNkEdSoLsgVigoiFFfw,10771
|
|
10
|
-
pyPreservica/retentionAPI.py,sha256=Cx1ofz9V31a8c8utEfKYLlfQaHSaaqg_D4R3LUFBEx0,23612
|
|
11
|
-
pyPreservica/uploadAPI.py,sha256=4Rdm9xvO2FKC8SirOP41g5wVnPEZLRI0Mz4KinxT-L4,93553
|
|
12
|
-
pyPreservica/vocabularyAPI.py,sha256=jPl6KDZoBGqlY0oEYjTpZ9kNEPzchDW-gyp-HH-MSKk,5729
|
|
13
|
-
pyPreservica/webHooksAPI.py,sha256=0wP-59mep8gtlIZ9P5vV68-HnNdTuuo2kzGcDWj0bNg,6790
|
|
14
|
-
pyPreservica/workflowAPI.py,sha256=QOMd4Nw69Vf8tJ7Px4gSLpug7VakAtNi-90UTgWSed0,17862
|
|
15
|
-
pyPreservica-2.6.5.dist-info/LICENSE.txt,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
16
|
-
pyPreservica-2.6.5.dist-info/METADATA,sha256=_EAz4x6us5peNLXe7e_UTK6lU1IEYAUMqcBvdAu06CU,2784
|
|
17
|
-
pyPreservica-2.6.5.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
18
|
-
pyPreservica-2.6.5.dist-info/top_level.txt,sha256=iIBh6NAznYQHOV8mv_y_kGKSDITek9rANyFDwJsbU-c,13
|
|
19
|
-
pyPreservica-2.6.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|