pyPreservica 3.2.4__py3-none-any.whl → 3.2.5__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
@@ -35,6 +35,6 @@ from .settingsAPI import SettingsAPI
35
35
  __author__ = "James Carr (drjamescarr@gmail.com)"
36
36
 
37
37
  # Version of the pyPreservica package
38
- __version__ = "3.2.4"
38
+ __version__ = "3.2.5"
39
39
 
40
40
  __license__ = "Apache License Version 2.0"
pyPreservica/common.py CHANGED
@@ -822,7 +822,6 @@ class AuthenticatedAPI:
822
822
  self.minor_version = int(version_numbers[1])
823
823
  self.patch_version = int(version_numbers[2])
824
824
 
825
-
826
825
  return version
827
826
  elif request.status_code == requests.codes.unauthorized:
828
827
  self.token = self.__token__()
@@ -831,6 +830,9 @@ class AuthenticatedAPI:
831
830
  logger.error(f"version number failed with http response {request.status_code}")
832
831
  logger.error(str(request.content))
833
832
  RuntimeError(request.status_code, "version number failed")
833
+ return None
834
+
835
+
834
836
 
835
837
  def __str__(self):
836
838
  return f"pyPreservica version: {pyPreservica.__version__} (Preservica 8.0 Compatible) " \
@@ -890,9 +892,11 @@ class AuthenticatedAPI:
890
892
  data = {'username': self.username,
891
893
  'continuationToken': response.json()['continuationToken'],
892
894
  'tenant': self.tenant, 'twoFactorToken': totp.now()}
895
+
896
+ header = {'Content-Type': 'application/x-www-form-urlencoded'}
893
897
  response_2fa = self.session.post(
894
898
  f'{self.protocol}://{self.server}/api/accesstoken/complete-2fa',
895
- data=data)
899
+ data=data, headers=header)
896
900
  if response_2fa.status_code == requests.codes.ok:
897
901
  return response_2fa.json()['token']
898
902
  else:
pyPreservica/entityAPI.py CHANGED
@@ -61,7 +61,7 @@ class EntityAPI(AuthenticatedAPI):
61
61
  Generator function to return bitstream chunks
62
62
 
63
63
  :param bitstream: The bitstream
64
- :param chunk_size: The chunk size to return
64
+ :param chunk_size: The chunk size to return (defaults to 4K)
65
65
  :return: A chunk of the requested bitstream content
66
66
  """
67
67
  if not isinstance(bitstream, Bitstream):
@@ -75,7 +75,7 @@ class EntityAPI(AuthenticatedAPI):
75
75
  for chunk in request.iter_content(chunk_size=chunk_size):
76
76
  yield chunk
77
77
  else:
78
- exception = HTTPException(bitstream.filename, request.status_code, request.url, "bitstream_content",
78
+ exception = HTTPException(bitstream.filename, request.status_code, request.url, "bitstream_chunks",
79
79
  request.content.decode('utf-8'))
80
80
  logger.error(exception)
81
81
  raise exception
@@ -113,7 +113,7 @@ class EntityAPI(AuthenticatedAPI):
113
113
  logger.error("Downloaded file size did not match the Preservica held value")
114
114
  return None
115
115
  else:
116
- exception = HTTPException(bitstream.filename, response.status_code, response.url, "bitstream_content",
116
+ exception = HTTPException(bitstream.filename, response.status_code, response.url, "bitstream_bytes",
117
117
  response.content.decode('utf-8'))
118
118
  logger.error(exception)
119
119
  raise exception
pyPreservica/uploadAPI.py CHANGED
@@ -1668,10 +1668,10 @@ class UploadAPI(AuthenticatedAPI):
1668
1668
  for page in paginator.paginate(Bucket=bucket_name):
1669
1669
  if 'Contents' in page:
1670
1670
  for key in page['Contents']:
1671
- last_modified = key["LastModified"]
1671
+ last_modified = key['LastModified']
1672
1672
  if abs((last_modified - now).days) > older_than_days:
1673
- logger.debug(f"Deleting expired object {key["Key"]}")
1674
- s3_client.delete_object(Bucket=bucket_name, Key=key["Key"])
1673
+ logger.debug(f"Deleting expired object {key['Key']}")
1674
+ s3_client.delete_object(Bucket=bucket_name, Key=key['Key'])
1675
1675
 
1676
1676
 
1677
1677
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyPreservica
3
- Version: 3.2.4
3
+ Version: 3.2.5
4
4
  Summary: Python library for the Preservica API
5
5
  Home-page: https://pypreservica.readthedocs.io/
6
6
  Author: James Carr
@@ -1,20 +1,20 @@
1
- pyPreservica/__init__.py,sha256=p5E_7PI_ApqO8L4roS1tYj-MHMmqvt4jdovD_fkTrmc,1250
1
+ pyPreservica/__init__.py,sha256=Lqe6IieUt542PCQEfLGEN7qZmByqdxDJdzu6uRyQ6_c,1250
2
2
  pyPreservica/adminAPI.py,sha256=Ls7uJA2Lu5t2k5vOFqrOlbZxmDrSp1-JuD_5z10w9w0,37990
3
3
  pyPreservica/authorityAPI.py,sha256=A52sFiAK4E4mlend_dknNIOW2BEwKXcLFI02anZBt3U,9211
4
- pyPreservica/common.py,sha256=qgKsiA6G9N88-QjV1sMrhhG_KsUtM5otd5G_YGwKC4I,39094
4
+ pyPreservica/common.py,sha256=vky_eupqQUG3zELTqqFMKP9m2kpwzXEgrxhGxxH6qDU,39231
5
5
  pyPreservica/contentAPI.py,sha256=ZvX2aGQEaksmw-m-oEUI6daVSqFe_IcE1cGwCNbSCDQ,22286
6
- pyPreservica/entityAPI.py,sha256=aPQy4lMoBeuCgbd9E_r7FO213oU_SSFHiIsEwGU5VLA,132395
6
+ pyPreservica/entityAPI.py,sha256=TErRGGMkvGxKBferwucde4wIH8rR3djsr6VOq2JqUqI,132409
7
7
  pyPreservica/mdformsAPI.py,sha256=D6p7uD2qNY76P6_k5MSaXnrYMp487hDXwladYvASejI,20052
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
12
  pyPreservica/settingsAPI.py,sha256=jXnMOCq3mimta6E-Os3J1I1if2pYsjLpOazAx8L-ZQI,10721
13
- pyPreservica/uploadAPI.py,sha256=Bl12EK6hAlkVQtwGk9PIx-eB0TpZpCO3QENhnRwjAss,102186
13
+ pyPreservica/uploadAPI.py,sha256=vYCfKicbpkjb78oCCkOzeB5T3Gl-zu-xZIvQPQ80Nio,102186
14
14
  pyPreservica/webHooksAPI.py,sha256=KMObsdHp_0K0HjJUl5oaFh-vs21GCAQZo2ZTKkY38R8,6872
15
15
  pyPreservica/workflowAPI.py,sha256=OcOiiUdrQerbPllrkj1lWpmuW0jTuyyV0urwPSYcd_U,17561
16
- pypreservica-3.2.4.dist-info/licenses/LICENSE.txt,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
17
- pypreservica-3.2.4.dist-info/METADATA,sha256=yE4kMep8IGjI5D7FrefwyR_lBFtCr0r9jZD7-jIpxKU,3077
18
- pypreservica-3.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- pypreservica-3.2.4.dist-info/top_level.txt,sha256=iIBh6NAznYQHOV8mv_y_kGKSDITek9rANyFDwJsbU-c,13
20
- pypreservica-3.2.4.dist-info/RECORD,,
16
+ pypreservica-3.2.5.dist-info/licenses/LICENSE.txt,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
17
+ pypreservica-3.2.5.dist-info/METADATA,sha256=1qISp87q4dr1eHJSUPi5wxX39QtQUgZYbHVynR6ynlw,3077
18
+ pypreservica-3.2.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ pypreservica-3.2.5.dist-info/top_level.txt,sha256=iIBh6NAznYQHOV8mv_y_kGKSDITek9rANyFDwJsbU-c,13
20
+ pypreservica-3.2.5.dist-info/RECORD,,