rclone-api 1.0.87__py2.py3-none-any.whl → 1.0.89__py2.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.
rclone_api/s3/types.py ADDED
@@ -0,0 +1,55 @@
1
+ from dataclasses import dataclass
2
+ from enum import Enum
3
+ from pathlib import Path
4
+
5
+
6
+ class S3Provider(Enum):
7
+ BACKBLAZE = "b2"
8
+ DIGITAL_OCEAN = "DigitalOcean"
9
+
10
+ @staticmethod
11
+ def from_str(value: str) -> "S3Provider":
12
+ """Convert string to S3Provider."""
13
+ if value == "b2":
14
+ return S3Provider.BACKBLAZE
15
+ if value == "DigitalOcean":
16
+ return S3Provider.DIGITAL_OCEAN
17
+ raise ValueError(f"Unknown S3Provider: {value}")
18
+
19
+
20
+ @dataclass
21
+ class S3Credentials:
22
+ """Credentials for accessing S3."""
23
+
24
+ provider: S3Provider
25
+ access_key_id: str
26
+ secret_access_key: str
27
+ session_token: str | None = None
28
+ region_name: str | None = None
29
+ endpoint_url: str | None = None
30
+
31
+
32
+ @dataclass
33
+ class S3UploadTarget:
34
+ """Target information for S3 upload."""
35
+
36
+ src_file: Path
37
+ bucket_name: str
38
+ s3_key: str
39
+
40
+
41
+ @dataclass
42
+ class S3MutliPartUploadConfig:
43
+ """Input for multi-part upload."""
44
+
45
+ chunk_size: int
46
+ retries: int
47
+ resume_path_json: Path
48
+ max_chunks_before_suspension: int | None = None
49
+
50
+
51
+ class MultiUploadResult(Enum):
52
+ UPLOADED_FRESH = 1
53
+ UPLOADED_RESUME = 2
54
+ SUSPENDED = 3
55
+ ALREADY_DONE = 4
rclone_api/types.py CHANGED
@@ -19,9 +19,11 @@ class Order(Enum):
19
19
  RANDOM = "random"
20
20
 
21
21
 
22
- # class GroupingOption(Enum):
23
- # BUCKET = "bucket"
24
- # REMOTE = "remote"
22
+ @dataclass
23
+ class S3PathInfo:
24
+ remote: str
25
+ bucket: str
26
+ key: str
25
27
 
26
28
 
27
29
  @dataclass
rclone_api/util.py CHANGED
@@ -11,6 +11,7 @@ from rclone_api.config import Config
11
11
  from rclone_api.dir import Dir
12
12
  from rclone_api.remote import Remote
13
13
  from rclone_api.rpath import RPath
14
+ from rclone_api.types import S3PathInfo
14
15
 
15
16
  # from .rclone import Rclone
16
17
 
@@ -126,7 +127,7 @@ def rclone_execute(
126
127
  print(f"Error cleaning up tempdir: {e}")
127
128
 
128
129
 
129
- def wait_for_mount(path: Path, mount_process: Any, timeout: int = 60) -> None:
130
+ def wait_for_mount(path: Path, mount_process: Any, timeout: int = 10) -> None:
130
131
  from rclone_api.process import Process
131
132
 
132
133
  assert isinstance(mount_process, Process)
@@ -134,7 +135,32 @@ def wait_for_mount(path: Path, mount_process: Any, timeout: int = 60) -> None:
134
135
  while time.time() < expire_time:
135
136
  rtn = mount_process.poll()
136
137
  if rtn is not None:
137
- raise subprocess.CalledProcessError(rtn, mount_process.cmd)
138
+ cmd_str = subprocess.list2cmdline(mount_process.cmd)
139
+ raise subprocess.CalledProcessError(rtn, cmd_str)
138
140
  if path.exists():
139
- return
140
- raise TimeoutError(f"Path {path} did not exist after {timeout} seconds")
141
+ # how many files?
142
+ dircontents = os.listdir(str(path))
143
+ if len(dircontents) > 0:
144
+ return
145
+ time.sleep(1)
146
+
147
+
148
+ def split_s3_path(path: str) -> S3PathInfo:
149
+ if ":" not in path:
150
+ raise ValueError(f"Invalid S3 path: {path}")
151
+
152
+ prts = path.split(":", 1)
153
+ remote = prts[0]
154
+ path = prts[1]
155
+ parts: list[str] = []
156
+ for part in path.split("/"):
157
+ part = part.strip()
158
+ if part:
159
+ parts.append(part)
160
+ if len(parts) < 2:
161
+ raise ValueError(f"Invalid S3 path: {path}")
162
+ bucket = parts[0]
163
+ key = "/".join(parts[1:])
164
+ assert bucket
165
+ assert key
166
+ return S3PathInfo(remote=remote, bucket=bucket, key=key)
@@ -1,9 +1,8 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.87
3
+ Version: 1.0.89
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
- Maintainer: Zachary Vorhies
7
6
  License: BSD 3-Clause License
8
7
  Keywords: template-python-cmd
9
8
  Classifier: Programming Language :: Python :: 3
@@ -12,8 +11,8 @@ Description-Content-Type: text/markdown
12
11
  License-File: LICENSE
13
12
  Requires-Dist: pyright>=1.1.393
14
13
  Requires-Dist: python-dotenv>=1.0.0
14
+ Requires-Dist: boto3<=1.35.99,>=1.20.1
15
15
  Dynamic: home-page
16
- Dynamic: maintainer
17
16
 
18
17
  # rclone-api
19
18
 
@@ -1,7 +1,7 @@
1
- rclone_api/__init__.py,sha256=UH1aIcovOSoiWwubbgBs_fvX3YcMhHnLTYJzLnCPKVs,722
1
+ rclone_api/__init__.py,sha256=m7hQkaIsn9grAlziu9nvDlOIQY6VflYFwC1c_g0qCJo,833
2
2
  rclone_api/cli.py,sha256=dibfAZIh0kXWsBbfp3onKLjyZXo54mTzDjUdzJlDlWo,231
3
3
  rclone_api/completed_process.py,sha256=_IZ8IWK7DM1_tsbDEkH6wPZ-bbcrgf7A7smls854pmg,1775
4
- rclone_api/config.py,sha256=tP6cU9DnCCEIRc_KP9HPur1jFLLg2QGFSxNwFm6_MVw,118
4
+ rclone_api/config.py,sha256=okqhnkV2fAAwm9nGc92-uDL6g69MlAWN3P6OKmRCQRY,2099
5
5
  rclone_api/convert.py,sha256=Mx9Qo7zhkOedJd8LdhPvNGHp8znJzOk4f_2KWnoGc78,1012
6
6
  rclone_api/deprecated.py,sha256=qWKpnZdYcBK7YQZKuVoWWXDwi-uqiAtbjgPcci_efow,590
7
7
  rclone_api/diff.py,sha256=tMoJMAGmLSE6Q_7QhPf6PnCzb840djxMZtDmhc2GlGQ,5227
@@ -10,20 +10,25 @@ rclone_api/dir_listing.py,sha256=GoziW8Sne6FY90MLNcb2aO3aaa3jphB6H8ExYrV0Ryo,188
10
10
  rclone_api/exec.py,sha256=1ovvaMXDEfLiT7BrYZyE85u_yFhEUwUNW3jPOzqknR8,1023
11
11
  rclone_api/file.py,sha256=EP5yT2dZ0H2p7CY5n0y5k5pHhIliV25pm8KOwBklUTk,1863
12
12
  rclone_api/filelist.py,sha256=xbiusvNgaB_b_kQOZoHMJJxn6TWGtPrWd2J042BI28o,767
13
- rclone_api/group_files.py,sha256=O8Awod4_ILGB4RfatBmiG4vXy9eO0rBhbEaZPr6X_sY,7969
13
+ rclone_api/group_files.py,sha256=H92xPW9lQnbNw5KbtZCl00bD6iRh9yRbCuxku4j_3dg,8036
14
14
  rclone_api/process.py,sha256=RrMfTe0bndmJ6gBK67ioqNvCstJ8aTC8RlGX1XBLlcw,4191
15
- rclone_api/rclone.py,sha256=vKCc8qqXdhoGiF_EXxHeeSc-ACPxen7yWzMbTjsNSuY,33983
15
+ rclone_api/rclone.py,sha256=qKOgK544zWCmD4Uowc35X0gq1BNGLwcAjIHFgOF9mH8,40603
16
16
  rclone_api/remote.py,sha256=O9WDUFQy9f6oT1HdUbTixK2eg0xtBBm8k4Xl6aa6K00,431
17
17
  rclone_api/rpath.py,sha256=8ZA_1wxWtskwcy0I8V2VbjKDmzPkiWd8Q2JQSvh-sYE,2586
18
18
  rclone_api/scan_missing_folders.py,sha256=Kulca2Q6WZodt00ATFHkmqqInuoPvBkhTcS9703y6po,4740
19
- rclone_api/types.py,sha256=9-qY0Z1NFwiIrvV3e4Ty-dVfed1I_482jPohJ-2hs-o,567
20
- rclone_api/util.py,sha256=XMrA2m_di4h8JTM-qyx2iyrFZn-l-or_SJOa5tEsDsI,4200
19
+ rclone_api/types.py,sha256=NC3e78aXCx-sEQ-FqEaC9KzaJDdJhJrKa4Nwum_-Db0,563
20
+ rclone_api/util.py,sha256=HwNqr_HmJvbK8uqHQRF6ockT9Nsgw4G1lUGEkEUkjEs,4910
21
21
  rclone_api/walk.py,sha256=-54NVE8EJcCstwDoaC_UtHm73R2HrZwVwQmsnv55xNU,3369
22
22
  rclone_api/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
23
23
  rclone_api/cmd/list_files.py,sha256=x8FHODEilwKqwdiU1jdkeJbLwOqUkUQuDWPo2u_zpf0,741
24
- rclone_api-1.0.87.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
25
- rclone_api-1.0.87.dist-info/METADATA,sha256=TvLc2MHDlp9wFZ1V3y5yQfA24_dz9Cnf7jtQnubKtLo,4489
26
- rclone_api-1.0.87.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
27
- rclone_api-1.0.87.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
28
- rclone_api-1.0.87.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
29
- rclone_api-1.0.87.dist-info/RECORD,,
24
+ rclone_api/s3/api.py,sha256=rFiUSQuW5q37CIfuN2mPq1aekFDMQ9lwH0qH9AQ9blg,2704
25
+ rclone_api/s3/basic_ops.py,sha256=hK3366xhVEzEcjz9Gk_8lFx6MRceAk72cax6mUrr6ko,2104
26
+ rclone_api/s3/chunk_uploader.py,sha256=Wcm4h_A6ORaJvT9P9qSeknbJYch22RKZ4FGo1iePlAw,17385
27
+ rclone_api/s3/create.py,sha256=M9_c30XYGUfqMY8o4Vl1OrVL7Fi416C7JqUEjDmb3_k,2741
28
+ rclone_api/s3/types.py,sha256=hGzmWx040X4Dmk_C7hugNk-DT1Zqs4staJy1b8z6PlY,1188
29
+ rclone_api-1.0.89.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
30
+ rclone_api-1.0.89.dist-info/METADATA,sha256=i1u6MZ5Go_-oYnV64Rbdm2zh8oOB6EPsPv3dGjEYQaI,4479
31
+ rclone_api-1.0.89.dist-info/WHEEL,sha256=rF4EZyR2XVS6irmOHQIJx2SUqXLZKRMUrjsg8UwN-XQ,109
32
+ rclone_api-1.0.89.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
33
+ rclone_api-1.0.89.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
34
+ rclone_api-1.0.89.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.8.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any