ae-cloud-storage 0.3.2__tar.gz → 0.3.4__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.
@@ -1,4 +1,4 @@
1
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_project V0.3.31 -->
1
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_project V0.3.32 -->
2
2
  ### GNU GENERAL PUBLIC LICENSE
3
3
 
4
4
  Version 3, 29 June 2007
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ae_cloud_storage
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: ae namespace module portion cloud_storage: distribute files to and retrieve them from cloud storage hosts.
5
5
  Home-page: https://gitlab.com/ae-group/ae_cloud_storage
6
6
  Author: AndiEcker
7
7
  Author-email: aecker2@gmail.com
8
8
  License: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
9
+ Project-URL: Bug Tracker, https://gitlab.com/ae-group/ae_cloud_storage/-/issues
9
10
  Project-URL: Documentation, https://ae.readthedocs.io/en/latest/_autosummary/ae.cloud_storage.html
10
11
  Project-URL: Repository, https://gitlab.com/ae-group/ae_cloud_storage
11
12
  Project-URL: Source, https://ae.readthedocs.io/en/latest/_modules/ae/cloud_storage.html
@@ -58,19 +59,19 @@ Requires-Dist: types-setuptools; extra == "tests"
58
59
  Requires-Dist: wheel; extra == "tests"
59
60
  Requires-Dist: twine; extra == "tests"
60
61
 
61
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.94 -->
62
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.95 -->
62
63
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
63
- # cloud_storage 0.3.2
64
+ # cloud_storage 0.3.4
64
65
 
65
66
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_cloud_storage/develop?logo=python)](
66
67
  https://gitlab.com/ae-group/ae_cloud_storage)
67
68
  [![LatestPyPIrelease](
68
- https://img.shields.io/gitlab/pipeline/ae-group/ae_cloud_storage/release0.3.1?logo=python)](
69
- https://gitlab.com/ae-group/ae_cloud_storage/-/tree/release0.3.1)
69
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_cloud_storage/release0.3.3?logo=python)](
70
+ https://gitlab.com/ae-group/ae_cloud_storage/-/tree/release0.3.3)
70
71
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_cloud_storage)](
71
72
  https://pypi.org/project/ae-cloud-storage/#history)
72
73
 
73
- >ae_cloud_storage module 0.3.2.
74
+ >ae_cloud_storage module 0.3.4.
74
75
 
75
76
  [![Coverage](https://ae-group.gitlab.io/ae_cloud_storage/coverage.svg)](
76
77
  https://ae-group.gitlab.io/ae_cloud_storage/coverage/index.html)
@@ -1,16 +1,16 @@
1
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.94 -->
1
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.95 -->
2
2
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
3
- # cloud_storage 0.3.2
3
+ # cloud_storage 0.3.4
4
4
 
5
5
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_cloud_storage/develop?logo=python)](
6
6
  https://gitlab.com/ae-group/ae_cloud_storage)
7
7
  [![LatestPyPIrelease](
8
- https://img.shields.io/gitlab/pipeline/ae-group/ae_cloud_storage/release0.3.1?logo=python)](
9
- https://gitlab.com/ae-group/ae_cloud_storage/-/tree/release0.3.1)
8
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_cloud_storage/release0.3.3?logo=python)](
9
+ https://gitlab.com/ae-group/ae_cloud_storage/-/tree/release0.3.3)
10
10
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_cloud_storage)](
11
11
  https://pypi.org/project/ae-cloud-storage/#history)
12
12
 
13
- >ae_cloud_storage module 0.3.2.
13
+ >ae_cloud_storage module 0.3.4.
14
14
 
15
15
  [![Coverage](https://ae-group.gitlab.io/ae_cloud_storage/coverage.svg)](
16
16
  https://ae-group.gitlab.io/ae_cloud_storage/coverage/index.html)
@@ -33,7 +33,7 @@ from googleapiclient.http import MediaFileUpload, MediaIoBaseDownload
33
33
  from ae.base import os_path_basename, os_path_isfile, os_path_join, read_file, ErrorMsgMixin # type: ignore
34
34
 
35
35
 
36
- __version__ = '0.3.2'
36
+ __version__ = '0.3.4'
37
37
 
38
38
 
39
39
  _registered_csh_classes = {} #: cloud storage class ids map to their related api classes, used by :func:`csh_api_class`
@@ -65,7 +65,8 @@ class CshApiBase(ErrorMsgMixin, ABC):
65
65
  """ add or update a binary file to the cloud storage host.
66
66
 
67
67
  :param file_path: path (relative to the host root) and name of the file to be deployed (added or updated).
68
- :param source_path: source path if differs from the destination path given in :paramref:`.folder_path`.
68
+ :param source_path: source path if differs from the destination path given in
69
+ :paramref:`~deploy_file.file_path`.
69
70
  :return: created/updated file path or empty string on error (see self.error_message for details).
70
71
  """
71
72
 
@@ -83,8 +84,8 @@ class CshApiBase(ErrorMsgMixin, ABC):
83
84
  def csh_api_class(csh_id: str) -> Type[CshApiBase]:
84
85
  """ determine from the specified cloud storage host id the associated api class
85
86
 
86
- :param csh_id:
87
- :return:
87
+ :param csh_id: id of the cloud storage api class.
88
+ :return: cloud storage api class if registered/declared, else the abstract class CshApiClass.
88
89
  """
89
90
  return _registered_csh_classes.get(csh_id, CshApiBase)
90
91
 
@@ -107,10 +108,8 @@ class DigiApi(CshApiBase):
107
108
  self.base_url = 'https://digistorage.es'
108
109
  self.session = requests.Session()
109
110
  token = self.session.get(self.base_url + '/token',
110
- headers={
111
- 'X-Koofr-Email': email,
112
- 'X-Koofr-Password': password
113
- }).headers['X-Koofr-Token']
111
+ headers={'X-Koofr-Email': email, 'X-Koofr-Password': password},
112
+ ).headers['X-Koofr-Token']
114
113
  self.session.headers['Authorization'] = 'Token ' + token
115
114
 
116
115
  api_prefix = '/api/v2/mounts'
@@ -173,7 +172,8 @@ class DigiApi(CshApiBase):
173
172
  """ add or update a binary file to the cloud storage host.
174
173
 
175
174
  :param file_path: path (relative to the host root) and name of the file to be deployed (added or updated).
176
- :param source_path: source path if differs from the destination path given in :paramref:`.folder_path`.
175
+ :param source_path: source path if differs from the destination path given in
176
+ :paramref:`~deploy_file.file_path`.
177
177
  :return: created/updated file path or empty string on error (see self.error_message for details).
178
178
  """
179
179
  if ':' in file_path:
@@ -234,7 +234,7 @@ class DigiApi(CshApiBase):
234
234
  self.session.close()
235
235
 
236
236
 
237
- class GoodriveApi(CshApiBase, ErrorMsgMixin):
237
+ class GoodriveApi(CshApiBase):
238
238
  """ upload, update, download and delete files from a Google Drive.
239
239
 
240
240
  to prepare Google Drive host api instance (root folder and authentication), create in your console (at
@@ -391,12 +391,14 @@ class GoodriveApi(CshApiBase, ErrorMsgMixin):
391
391
  """ add or update a binary file to the cloud storage host.
392
392
 
393
393
  :param file_path: path (relative to the host root) and name of the file to be deployed (added or updated).
394
- :param source_path: source path if differs from the destination path given in :paramref:`.folder_path`.
394
+ :param source_path: source path if differs from the destination path given in
395
+ :paramref:`~deploy_file.file_path`.
395
396
  :return: created/updated file id or empty string on error (check self.error_message for details).
396
397
 
397
398
  .. note::
398
399
  sometimes :meth:`.folder_file_ids` fails to see a deployed file directly after the deployment. on subsequent
399
400
  bulk deployments use :meth:`.wait_for_deployment_finish` to wait for finished/completed deployment.
401
+
400
402
  """
401
403
  if ':' in file_path:
402
404
  self.error_message = f"invalid character ':' in remote file name/path '{file_path}'"
@@ -415,21 +417,27 @@ class GoodriveApi(CshApiBase, ErrorMsgMixin):
415
417
  def folder_file_ids(self, file_path: str, folder_id: str = '', create_folders: bool = False) -> tuple[str, str]:
416
418
  """ convert Google Drive file path into the related folder and file ids.
417
419
 
418
- :param file_path: path of a file or folder, relative to the folder specified in :paramref:`.folder_id`.
419
- :param folder_id: Google Drive folder id of the root folder where :paramref:`.folder_path` is underneath
420
- of. if not passed then it defaults to the root folder (specified via __init__()).
421
- .. note:: MyDrive GOOGLE_DRIVE_DEFAULT_ROOT_FOLDER/'root' id is working for OAuth2,
422
- but not for service accounts authentication.
420
+ :param file_path: path of a file or folder, relative to the folder specified in
421
+ :paramref:`~folder_file_ids.folder_id`.
422
+ :param folder_id: Google Drive folder id of the root folder where :paramref:`~folder_file_ids.folder_path`
423
+ is underneath of. if not passed then it defaults to the root folder (specified via
424
+ __init__()).
425
+
426
+ .. note::
427
+ MyDrive GOOGLE_DRIVE_DEFAULT_ROOT_FOLDER/'root' id is working for OAuth2,
428
+ but not for service accounts authentication.
423
429
  :param create_folders: pass True to create non-existing folders in the specified file path.
424
430
  :return: tuple of ids of the specified folder and of the basename file/folder.
425
431
  if the second tuple item is an empty string then an error occurred, because either
426
432
  the specified folder/file does not exist,
427
433
  or the specified basename ends with a slash, although it is a file.
428
- .. note::
429
- if :paramref:`.folder_path` specifies a Google Drive cloud mimetype, like
430
- Google Doc/Sheet/.., then although the file id get returned, an error
431
- message get set (stating that Google Docs cannot be downloaded as files via
432
- :meth:`.deployed_file_content`).
434
+
435
+ .. note::
436
+ if :paramref:`~folder_file_ids.folder_path` specifies a Google Drive cloud mimetype, like
437
+ Google Doc/Sheet/.., then although the file id get returned, an error
438
+ message get set (stating that Google Docs cannot be downloaded as files via
439
+ :meth:`.deployed_file_content`).
440
+
433
441
  """
434
442
  if not folder_id:
435
443
  folder_id = self.root_folder_id_default
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ae_cloud_storage
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: ae namespace module portion cloud_storage: distribute files to and retrieve them from cloud storage hosts.
5
5
  Home-page: https://gitlab.com/ae-group/ae_cloud_storage
6
6
  Author: AndiEcker
7
7
  Author-email: aecker2@gmail.com
8
8
  License: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
9
+ Project-URL: Bug Tracker, https://gitlab.com/ae-group/ae_cloud_storage/-/issues
9
10
  Project-URL: Documentation, https://ae.readthedocs.io/en/latest/_autosummary/ae.cloud_storage.html
10
11
  Project-URL: Repository, https://gitlab.com/ae-group/ae_cloud_storage
11
12
  Project-URL: Source, https://ae.readthedocs.io/en/latest/_modules/ae/cloud_storage.html
@@ -58,19 +59,19 @@ Requires-Dist: types-setuptools; extra == "tests"
58
59
  Requires-Dist: wheel; extra == "tests"
59
60
  Requires-Dist: twine; extra == "tests"
60
61
 
61
- <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.94 -->
62
+ <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project ae.ae V0.3.95 -->
62
63
  <!-- THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_namespace_root V0.3.14 -->
63
- # cloud_storage 0.3.2
64
+ # cloud_storage 0.3.4
64
65
 
65
66
  [![GitLab develop](https://img.shields.io/gitlab/pipeline/ae-group/ae_cloud_storage/develop?logo=python)](
66
67
  https://gitlab.com/ae-group/ae_cloud_storage)
67
68
  [![LatestPyPIrelease](
68
- https://img.shields.io/gitlab/pipeline/ae-group/ae_cloud_storage/release0.3.1?logo=python)](
69
- https://gitlab.com/ae-group/ae_cloud_storage/-/tree/release0.3.1)
69
+ https://img.shields.io/gitlab/pipeline/ae-group/ae_cloud_storage/release0.3.3?logo=python)](
70
+ https://gitlab.com/ae-group/ae_cloud_storage/-/tree/release0.3.3)
70
71
  [![PyPIVersions](https://img.shields.io/pypi/v/ae_cloud_storage)](
71
72
  https://pypi.org/project/ae-cloud-storage/#history)
72
73
 
73
- >ae_cloud_storage module 0.3.2.
74
+ >ae_cloud_storage module 0.3.4.
74
75
 
75
76
  [![Coverage](https://ae-group.gitlab.io/ae_cloud_storage/coverage.svg)](
76
77
  https://ae-group.gitlab.io/ae_cloud_storage/coverage/index.html)
@@ -1,4 +1,4 @@
1
- # THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_project V0.3.31
1
+ # THIS FILE IS EXCLUSIVELY MAINTAINED by the project aedev.tpl_project V0.3.32
2
2
  """ setup this project with setuptools and aedev.setup_project. """
3
3
  import pprint
4
4
  import sys
@@ -11,7 +11,7 @@ from ae.cloud_storage import DigiApi, GoodriveApi, csh_api_class
11
11
 
12
12
 
13
13
  load_dotenvs()
14
- tst_digi_root_folder = os.environ.get('TEST_DIGI_ROOT_FOLDER_NAME')
14
+ tst_digi_root_folder = os.environ.get('TEST_DIGI_ROOT_FOLDER_PATH')
15
15
  tst_digi_email = os.environ.get('TEST_DIGI_API_EMAIL')
16
16
  tst_digi_password = os.environ.get('TEST_DIGI_API_PASSWORD')
17
17