rclone-api 1.5.3__tar.gz → 1.5.5__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.
- {rclone_api-1.5.3 → rclone_api-1.5.5}/PKG-INFO +138 -114
- {rclone_api-1.5.3 → rclone_api-1.5.5}/README.md +137 -113
- {rclone_api-1.5.3 → rclone_api-1.5.5}/pyproject.toml +1 -1
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/__init__.py +21 -18
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/rclone_impl.py +38 -34
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api.egg-info/PKG-INFO +138 -114
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.aiderignore +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.github/workflows/lint.yml +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.github/workflows/push_macos.yml +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.github/workflows/push_ubuntu.yml +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.github/workflows/push_win.yml +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.gitignore +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.pylintrc +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.vscode/launch.json +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.vscode/settings.json +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/.vscode/tasks.json +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/LICENSE +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/MANIFEST.in +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/clean +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/install +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/lint +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/requirements.testing.txt +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/setup.cfg +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/setup.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/assets/example.txt +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/cli.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/cmd/analyze.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/cmd/copy_large_s3.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/cmd/copy_large_s3_finish.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/cmd/list_files.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/cmd/save_to_db.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/completed_process.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/config.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/convert.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/db/__init__.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/db/db.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/db/models.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/deprecated.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/detail/copy_file_parts_resumable.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/detail/walk.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/diff.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/dir.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/dir_listing.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/exec.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/experimental/flags.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/experimental/flags_base.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/file.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/file_item.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/file_part.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/file_stream.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/filelist.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/group_files.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/http_server.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/install.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/log.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/mount.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/process.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/remote.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/rpath.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/api.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/basic_ops.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/chunk_task.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/create.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/multipart/file_info.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/multipart/finished_piece.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/multipart/info_json.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/multipart/merge_state.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/multipart/upload_info.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/multipart/upload_parts_inline.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/multipart/upload_parts_resumable.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/multipart/upload_parts_server_side_merge.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/multipart/upload_state.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/s3/types.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/scan_missing_folders.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/types.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api/util.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api.egg-info/SOURCES.txt +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api.egg-info/dependency_links.txt +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api.egg-info/entry_points.txt +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api.egg-info/requires.txt +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/src/rclone_api.egg-info/top_level.txt +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/test +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/archive/test_paramiko.py.disabled +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_cmd_list_files.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_copy.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_copy_bytes.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_copy_file_resumable_s3.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_copy_files.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_db.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_diff.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_file_item.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_group_files.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_install.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_is_synced.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_ls.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_ls_stream_files.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_mount.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_mount_s3.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_obscure.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_rclone_config.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_read_write_text.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_remote_control.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_remotes.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_s3.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_scan_missing_folders.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_serve_http.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_size_files.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_size_suffix.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tests/test_walk.py +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/tox.ini +0 -0
- {rclone_api-1.5.3 → rclone_api-1.5.5}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: rclone_api
|
3
|
-
Version: 1.5.
|
3
|
+
Version: 1.5.5
|
4
4
|
Summary: rclone api in python
|
5
5
|
Home-page: https://github.com/zackees/rclone-api
|
6
6
|
License: BSD 3-Clause License
|
@@ -99,22 +99,43 @@ def test_ls_glob_png(self) -> None:
|
|
99
99
|
## API
|
100
100
|
|
101
101
|
```python
|
102
|
+
|
103
|
+
from rclone_api import Rclone
|
104
|
+
|
102
105
|
class Rclone:
|
103
106
|
"""
|
104
107
|
Main interface for interacting with Rclone.
|
105
|
-
|
108
|
+
|
106
109
|
This class provides methods for all major Rclone operations including
|
107
110
|
file transfers, listing, mounting, and remote management.
|
108
|
-
|
111
|
+
|
109
112
|
It serves as the primary entry point for the API, wrapping the underlying
|
110
113
|
implementation details and providing a clean, consistent interface.
|
111
114
|
"""
|
115
|
+
|
116
|
+
@staticmethod
|
117
|
+
def upgrade_rclone() -> Path:
|
118
|
+
"""
|
119
|
+
Upgrade the rclone executable to the latest version.
|
120
|
+
|
121
|
+
Downloads the latest rclone binary and replaces the current one.
|
122
|
+
|
123
|
+
If an external rclone is already in your path then although upgrade_rclone
|
124
|
+
will download the latest version, it will not affect the rclone selected.
|
125
|
+
|
126
|
+
Returns:
|
127
|
+
Path to the upgraded rclone executable
|
128
|
+
"""
|
129
|
+
from rclone_api.util import upgrade_rclone
|
130
|
+
|
131
|
+
return upgrade_rclone()
|
132
|
+
|
112
133
|
def __init__(
|
113
134
|
self, rclone_conf: Path | Config, rclone_exe: Path | None = None
|
114
135
|
) -> None:
|
115
136
|
"""
|
116
137
|
Initialize the Rclone interface.
|
117
|
-
|
138
|
+
|
118
139
|
Args:
|
119
140
|
rclone_conf: Path to rclone config file or Config object
|
120
141
|
rclone_exe: Optional path to rclone executable. If None, will search in PATH.
|
@@ -126,12 +147,12 @@ class Rclone:
|
|
126
147
|
def webgui(self, other_args: list[str] | None = None) -> Process:
|
127
148
|
"""
|
128
149
|
Launch the Rclone web GUI.
|
129
|
-
|
150
|
+
|
130
151
|
Starts the built-in web interface for interacting with rclone.
|
131
|
-
|
152
|
+
|
132
153
|
Args:
|
133
154
|
other_args: Additional command-line arguments to pass to rclone
|
134
|
-
|
155
|
+
|
135
156
|
Returns:
|
136
157
|
Process object representing the running web GUI
|
137
158
|
"""
|
@@ -146,15 +167,15 @@ class Rclone:
|
|
146
167
|
) -> Process:
|
147
168
|
"""
|
148
169
|
Launch the Rclone server so it can receive commands.
|
149
|
-
|
170
|
+
|
150
171
|
Starts an rclone server that can be controlled remotely.
|
151
|
-
|
172
|
+
|
152
173
|
Args:
|
153
174
|
addr: Address and port to listen on (e.g., "localhost:5572")
|
154
175
|
user: Optional username for authentication
|
155
176
|
password: Optional password for authentication
|
156
177
|
other_args: Additional command-line arguments
|
157
|
-
|
178
|
+
|
158
179
|
Returns:
|
159
180
|
Process object representing the running server
|
160
181
|
"""
|
@@ -172,14 +193,14 @@ class Rclone:
|
|
172
193
|
) -> CompletedProcess:
|
173
194
|
"""
|
174
195
|
Send commands to a running rclone server.
|
175
|
-
|
196
|
+
|
176
197
|
Args:
|
177
198
|
addr: Address of the rclone server (e.g., "localhost:5572")
|
178
199
|
user: Optional username for authentication
|
179
200
|
password: Optional password for authentication
|
180
201
|
capture: Whether to capture and return command output
|
181
202
|
other_args: Additional command-line arguments
|
182
|
-
|
203
|
+
|
183
204
|
Returns:
|
184
205
|
CompletedProcess containing the command result
|
185
206
|
"""
|
@@ -194,13 +215,13 @@ class Rclone:
|
|
194
215
|
def obscure(self, password: str) -> str:
|
195
216
|
"""
|
196
217
|
Obscure a password for use in rclone config files.
|
197
|
-
|
218
|
+
|
198
219
|
Converts a plaintext password to rclone's obscured format.
|
199
220
|
Note that this is not secure encryption, just light obfuscation.
|
200
|
-
|
221
|
+
|
201
222
|
Args:
|
202
223
|
password: The plaintext password to obscure
|
203
|
-
|
224
|
+
|
204
225
|
Returns:
|
205
226
|
The obscured password string
|
206
227
|
"""
|
@@ -208,25 +229,25 @@ class Rclone:
|
|
208
229
|
|
209
230
|
def ls_stream(
|
210
231
|
self,
|
211
|
-
|
232
|
+
src: str,
|
212
233
|
max_depth: int = -1,
|
213
234
|
fast_list: bool = False,
|
214
235
|
) -> FilesStream:
|
215
236
|
"""
|
216
237
|
List files in the given path as a stream of results.
|
217
|
-
|
238
|
+
|
218
239
|
This method is memory-efficient for large directories as it yields
|
219
240
|
results incrementally rather than collecting them all at once.
|
220
|
-
|
241
|
+
|
221
242
|
Args:
|
222
|
-
|
243
|
+
src: Remote path to list
|
223
244
|
max_depth: Maximum recursion depth (-1 for unlimited)
|
224
245
|
fast_list: Use fast list (only recommended for listing entire repositories or small datasets)
|
225
|
-
|
246
|
+
|
226
247
|
Returns:
|
227
248
|
A stream of file entries that can be iterated over
|
228
249
|
"""
|
229
|
-
return self.impl.ls_stream(
|
250
|
+
return self.impl.ls_stream(src=src, max_depth=max_depth, fast_list=fast_list)
|
230
251
|
|
231
252
|
def save_to_db(
|
232
253
|
self,
|
@@ -237,10 +258,10 @@ class Rclone:
|
|
237
258
|
) -> None:
|
238
259
|
"""
|
239
260
|
Save files to a database (sqlite, mysql, postgres).
|
240
|
-
|
261
|
+
|
241
262
|
Lists all files in the source path and stores their metadata in a database.
|
242
263
|
Useful for creating searchable indexes of remote storage.
|
243
|
-
|
264
|
+
|
244
265
|
Args:
|
245
266
|
src: Remote path to list, this will be used to populate an entire table, so always use the root-most path.
|
246
267
|
db_url: Database URL, like sqlite:///data.db or mysql://user:pass@localhost/db or postgres://user:pass@localhost/db
|
@@ -253,7 +274,7 @@ class Rclone:
|
|
253
274
|
|
254
275
|
def ls(
|
255
276
|
self,
|
256
|
-
|
277
|
+
src: Dir | Remote | str | None = None,
|
257
278
|
max_depth: int | None = None,
|
258
279
|
glob: str | None = None,
|
259
280
|
order: Order = Order.NORMAL,
|
@@ -261,21 +282,21 @@ class Rclone:
|
|
261
282
|
) -> DirListing:
|
262
283
|
"""
|
263
284
|
List files and directories at the specified path.
|
264
|
-
|
285
|
+
|
265
286
|
Provides a detailed listing with file metadata.
|
266
|
-
|
287
|
+
|
267
288
|
Args:
|
268
|
-
|
289
|
+
src: Path to list (Dir, Remote, or string path)
|
269
290
|
max_depth: Maximum recursion depth (None for default)
|
270
291
|
glob: Optional glob pattern to filter results
|
271
292
|
order: Sorting order for the results
|
272
293
|
listing_option: What types of entries to include
|
273
|
-
|
294
|
+
|
274
295
|
Returns:
|
275
296
|
DirListing object containing the results
|
276
297
|
"""
|
277
298
|
return self.impl.ls(
|
278
|
-
|
299
|
+
src=src,
|
279
300
|
max_depth=max_depth,
|
280
301
|
glob=glob,
|
281
302
|
order=order,
|
@@ -285,9 +306,9 @@ class Rclone:
|
|
285
306
|
def listremotes(self) -> list[Remote]:
|
286
307
|
"""
|
287
308
|
List all configured remotes.
|
288
|
-
|
309
|
+
|
289
310
|
Returns a list of all remotes defined in the rclone configuration.
|
290
|
-
|
311
|
+
|
291
312
|
Returns:
|
292
313
|
List of Remote objects
|
293
314
|
"""
|
@@ -311,10 +332,10 @@ class Rclone:
|
|
311
332
|
) -> Generator[DiffItem, None, None]:
|
312
333
|
"""
|
313
334
|
Compare two directories and yield differences.
|
314
|
-
|
335
|
+
|
315
336
|
Be extra careful with the src and dst values. If you are off by one
|
316
337
|
parent directory, you will get a huge amount of false diffs.
|
317
|
-
|
338
|
+
|
318
339
|
Args:
|
319
340
|
src: Rclone style src path
|
320
341
|
dst: Rclone style dst path
|
@@ -325,7 +346,7 @@ class Rclone:
|
|
325
346
|
size_only: Compare only file sizes, not content
|
326
347
|
checkers: Number of checker threads
|
327
348
|
other_args: Additional command-line arguments
|
328
|
-
|
349
|
+
|
329
350
|
Yields:
|
330
351
|
DiffItem objects representing each difference found
|
331
352
|
"""
|
@@ -343,28 +364,28 @@ class Rclone:
|
|
343
364
|
|
344
365
|
def walk(
|
345
366
|
self,
|
346
|
-
|
367
|
+
src: Dir | Remote | str,
|
347
368
|
max_depth: int = -1,
|
348
369
|
breadth_first: bool = True,
|
349
370
|
order: Order = Order.NORMAL,
|
350
371
|
) -> Generator[DirListing, None, None]:
|
351
372
|
"""
|
352
373
|
Walk through the given path recursively, yielding directory listings.
|
353
|
-
|
374
|
+
|
354
375
|
Similar to os.walk(), but for remote storage. Traverses directories
|
355
376
|
and yields their contents.
|
356
|
-
|
377
|
+
|
357
378
|
Args:
|
358
|
-
|
379
|
+
src: Remote path, Dir, or Remote object to walk through
|
359
380
|
max_depth: Maximum depth to traverse (-1 for unlimited)
|
360
381
|
breadth_first: If True, use breadth-first traversal, otherwise depth-first
|
361
382
|
order: Sorting order for directory entries
|
362
|
-
|
383
|
+
|
363
384
|
Yields:
|
364
385
|
DirListing: Directory listing for each directory encountered
|
365
386
|
"""
|
366
387
|
return self.impl.walk(
|
367
|
-
|
388
|
+
src=src, max_depth=max_depth, breadth_first=breadth_first, order=order
|
368
389
|
)
|
369
390
|
|
370
391
|
def scan_missing_folders(
|
@@ -376,16 +397,16 @@ class Rclone:
|
|
376
397
|
) -> Generator[Dir, None, None]:
|
377
398
|
"""
|
378
399
|
Find folders that exist in source but are missing in destination.
|
379
|
-
|
400
|
+
|
380
401
|
Useful for identifying directories that need to be created before
|
381
402
|
copying files.
|
382
|
-
|
403
|
+
|
383
404
|
Args:
|
384
405
|
src: Source directory or Remote to scan
|
385
406
|
dst: Destination directory or Remote to compare against
|
386
407
|
max_depth: Maximum depth to traverse (-1 for unlimited)
|
387
408
|
order: Sorting order for directory entries
|
388
|
-
|
409
|
+
|
389
410
|
Yields:
|
390
411
|
Dir: Each directory that exists in source but not in destination
|
391
412
|
"""
|
@@ -394,21 +415,21 @@ class Rclone:
|
|
394
415
|
)
|
395
416
|
|
396
417
|
def cleanup(
|
397
|
-
self,
|
418
|
+
self, src: str, other_args: list[str] | None = None
|
398
419
|
) -> CompletedProcess:
|
399
420
|
"""
|
400
421
|
Cleanup any resources used by the Rclone instance.
|
401
|
-
|
422
|
+
|
402
423
|
Removes temporary files and directories created by rclone.
|
403
|
-
|
424
|
+
|
404
425
|
Args:
|
405
|
-
|
426
|
+
src: Path to clean up
|
406
427
|
other_args: Additional command-line arguments
|
407
|
-
|
428
|
+
|
408
429
|
Returns:
|
409
430
|
CompletedProcess with the result of the cleanup operation
|
410
431
|
"""
|
411
|
-
return self.impl.cleanup(
|
432
|
+
return self.impl.cleanup(src=src, other_args=other_args)
|
412
433
|
|
413
434
|
def copy_to(
|
414
435
|
self,
|
@@ -420,17 +441,17 @@ class Rclone:
|
|
420
441
|
) -> CompletedProcess:
|
421
442
|
"""
|
422
443
|
Copy one file from source to destination.
|
423
|
-
|
444
|
+
|
424
445
|
Warning - this can be slow for large files or when copying between
|
425
446
|
different storage providers.
|
426
|
-
|
447
|
+
|
427
448
|
Args:
|
428
449
|
src: Rclone style src path
|
429
450
|
dst: Rclone style dst path
|
430
451
|
check: Whether to verify the copy with checksums
|
431
452
|
verbose: Whether to show detailed progress
|
432
453
|
other_args: Additional command-line arguments
|
433
|
-
|
454
|
+
|
434
455
|
Returns:
|
435
456
|
CompletedProcess with the result of the copy operation
|
436
457
|
"""
|
@@ -459,9 +480,9 @@ class Rclone:
|
|
459
480
|
) -> list[CompletedProcess]:
|
460
481
|
"""
|
461
482
|
Copy multiple files from source to destination.
|
462
|
-
|
483
|
+
|
463
484
|
Efficiently copies a list of files, potentially in parallel.
|
464
|
-
|
485
|
+
|
465
486
|
Args:
|
466
487
|
src: Rclone style src path
|
467
488
|
dst: Rclone style dst path
|
@@ -479,7 +500,7 @@ class Rclone:
|
|
479
500
|
max_partition_workers: Maximum number of partition workers
|
480
501
|
multi_thread_streams: Number of streams for multi-thread copy
|
481
502
|
other_args: Additional command-line arguments
|
482
|
-
|
503
|
+
|
483
504
|
Returns:
|
484
505
|
List of CompletedProcess objects for each copy operation
|
485
506
|
"""
|
@@ -516,9 +537,9 @@ class Rclone:
|
|
516
537
|
) -> CompletedProcess:
|
517
538
|
"""
|
518
539
|
Copy files from source to destination.
|
519
|
-
|
540
|
+
|
520
541
|
Recursively copies all files from src to dst.
|
521
|
-
|
542
|
+
|
522
543
|
Args:
|
523
544
|
src: Rclone style src path
|
524
545
|
dst: Rclone style dst path
|
@@ -529,7 +550,7 @@ class Rclone:
|
|
529
550
|
low_level_retries: Number of low-level retries
|
530
551
|
retries: Number of high-level retries
|
531
552
|
other_args: Additional command-line arguments
|
532
|
-
|
553
|
+
|
533
554
|
Returns:
|
534
555
|
CompletedProcess with the result of the copy operation
|
535
556
|
"""
|
@@ -545,19 +566,19 @@ class Rclone:
|
|
545
566
|
other_args=other_args,
|
546
567
|
)
|
547
568
|
|
548
|
-
def purge(self,
|
569
|
+
def purge(self, src: Dir | str) -> CompletedProcess:
|
549
570
|
"""
|
550
571
|
Purge a directory.
|
551
|
-
|
572
|
+
|
552
573
|
Removes a directory and all its contents.
|
553
|
-
|
574
|
+
|
554
575
|
Args:
|
555
|
-
|
556
|
-
|
576
|
+
src: Rclone style path
|
577
|
+
|
557
578
|
Returns:
|
558
579
|
CompletedProcess with the result of the purge operation
|
559
580
|
"""
|
560
|
-
return self.impl.purge(
|
581
|
+
return self.impl.purge(src=src)
|
561
582
|
|
562
583
|
def delete_files(
|
563
584
|
self,
|
@@ -570,7 +591,7 @@ class Rclone:
|
|
570
591
|
) -> CompletedProcess:
|
571
592
|
"""
|
572
593
|
Delete files or directories.
|
573
|
-
|
594
|
+
|
574
595
|
Args:
|
575
596
|
files: Files to delete (single file/path or list)
|
576
597
|
check: Whether to verify deletions
|
@@ -578,7 +599,7 @@ class Rclone:
|
|
578
599
|
verbose: Whether to show detailed progress
|
579
600
|
max_partition_workers: Maximum number of partition workers
|
580
601
|
other_args: Additional command-line arguments
|
581
|
-
|
602
|
+
|
582
603
|
Returns:
|
583
604
|
CompletedProcess with the result of the delete operation
|
584
605
|
"""
|
@@ -591,28 +612,28 @@ class Rclone:
|
|
591
612
|
other_args=other_args,
|
592
613
|
)
|
593
614
|
|
594
|
-
def exists(self,
|
615
|
+
def exists(self, src: Dir | Remote | str | File) -> bool:
|
595
616
|
"""
|
596
617
|
Check if a file or directory exists.
|
597
|
-
|
618
|
+
|
598
619
|
Args:
|
599
|
-
|
600
|
-
|
620
|
+
src: Path to check (Dir, Remote, File, or path string)
|
621
|
+
|
601
622
|
Returns:
|
602
623
|
True if the path exists, False otherwise
|
603
624
|
"""
|
604
|
-
return self.impl.exists(
|
625
|
+
return self.impl.exists(src=src)
|
605
626
|
|
606
627
|
def is_synced(self, src: str | Dir, dst: str | Dir) -> bool:
|
607
628
|
"""
|
608
629
|
Check if two directories are in sync.
|
609
|
-
|
630
|
+
|
610
631
|
Compares the contents of src and dst to determine if they match.
|
611
|
-
|
632
|
+
|
612
633
|
Args:
|
613
634
|
src: Source directory (Dir object or path string)
|
614
635
|
dst: Destination directory (Dir object or path string)
|
615
|
-
|
636
|
+
|
616
637
|
Returns:
|
617
638
|
True if the directories are in sync, False otherwise
|
618
639
|
"""
|
@@ -621,10 +642,10 @@ class Rclone:
|
|
621
642
|
def modtime(self, src: str) -> str | Exception:
|
622
643
|
"""
|
623
644
|
Get the modification time of a file or directory.
|
624
|
-
|
645
|
+
|
625
646
|
Args:
|
626
647
|
src: Path to the file or directory
|
627
|
-
|
648
|
+
|
628
649
|
Returns:
|
629
650
|
Modification time as a string, or Exception if an error occurred
|
630
651
|
"""
|
@@ -633,10 +654,10 @@ class Rclone:
|
|
633
654
|
def modtime_dt(self, src: str) -> datetime | Exception:
|
634
655
|
"""
|
635
656
|
Get the modification time of a file or directory as a datetime object.
|
636
|
-
|
657
|
+
|
637
658
|
Args:
|
638
659
|
src: Path to the file or directory
|
639
|
-
|
660
|
+
|
640
661
|
Returns:
|
641
662
|
Modification time as a datetime object, or Exception if an error occurred
|
642
663
|
"""
|
@@ -649,13 +670,13 @@ class Rclone:
|
|
649
670
|
) -> Exception | None:
|
650
671
|
"""
|
651
672
|
Write text to a file.
|
652
|
-
|
673
|
+
|
653
674
|
Creates or overwrites the file at dst with the given text.
|
654
|
-
|
675
|
+
|
655
676
|
Args:
|
656
677
|
text: Text content to write
|
657
678
|
dst: Destination file path
|
658
|
-
|
679
|
+
|
659
680
|
Returns:
|
660
681
|
None if successful, Exception if an error occurred
|
661
682
|
"""
|
@@ -668,13 +689,13 @@ class Rclone:
|
|
668
689
|
) -> Exception | None:
|
669
690
|
"""
|
670
691
|
Write bytes to a file.
|
671
|
-
|
692
|
+
|
672
693
|
Creates or overwrites the file at dst with the given binary data.
|
673
|
-
|
694
|
+
|
674
695
|
Args:
|
675
696
|
data: Binary content to write
|
676
697
|
dst: Destination file path
|
677
|
-
|
698
|
+
|
678
699
|
Returns:
|
679
700
|
None if successful, Exception if an error occurred
|
680
701
|
"""
|
@@ -683,10 +704,10 @@ class Rclone:
|
|
683
704
|
def read_bytes(self, src: str) -> bytes | Exception:
|
684
705
|
"""
|
685
706
|
Read bytes from a file.
|
686
|
-
|
707
|
+
|
687
708
|
Args:
|
688
709
|
src: Source file path
|
689
|
-
|
710
|
+
|
690
711
|
Returns:
|
691
712
|
File contents as bytes, or Exception if an error occurred
|
692
713
|
"""
|
@@ -695,10 +716,10 @@ class Rclone:
|
|
695
716
|
def read_text(self, src: str) -> str | Exception:
|
696
717
|
"""
|
697
718
|
Read text from a file.
|
698
|
-
|
719
|
+
|
699
720
|
Args:
|
700
721
|
src: Source file path
|
701
|
-
|
722
|
+
|
702
723
|
Returns:
|
703
724
|
File contents as a string, or Exception if an error occurred
|
704
725
|
"""
|
@@ -714,16 +735,16 @@ class Rclone:
|
|
714
735
|
) -> Exception | None:
|
715
736
|
"""
|
716
737
|
Copy a slice of bytes from the src file to dst.
|
717
|
-
|
738
|
+
|
718
739
|
Extracts a portion of a file based on offset and length.
|
719
|
-
|
740
|
+
|
720
741
|
Args:
|
721
742
|
src: Source file path
|
722
743
|
offset: Starting position in the source file
|
723
744
|
length: Number of bytes to copy
|
724
745
|
outfile: Local file path to write the bytes to
|
725
746
|
other_args: Additional command-line arguments
|
726
|
-
|
747
|
+
|
727
748
|
Returns:
|
728
749
|
None if successful, Exception if an error occurred
|
729
750
|
"""
|
@@ -740,14 +761,14 @@ class Rclone:
|
|
740
761
|
) -> CompletedProcess:
|
741
762
|
"""
|
742
763
|
Copy a directory from source to destination.
|
743
|
-
|
764
|
+
|
744
765
|
Recursively copies all files and subdirectories.
|
745
|
-
|
766
|
+
|
746
767
|
Args:
|
747
768
|
src: Source directory (Dir object or path string)
|
748
769
|
dst: Destination directory (Dir object or path string)
|
749
770
|
args: Additional command-line arguments
|
750
|
-
|
771
|
+
|
751
772
|
Returns:
|
752
773
|
CompletedProcess with the result of the copy operation
|
753
774
|
"""
|
@@ -759,14 +780,14 @@ class Rclone:
|
|
759
780
|
) -> CompletedProcess:
|
760
781
|
"""
|
761
782
|
Copy a remote to another remote.
|
762
|
-
|
783
|
+
|
763
784
|
Copies all contents from one remote storage to another.
|
764
|
-
|
785
|
+
|
765
786
|
Args:
|
766
787
|
src: Source remote
|
767
788
|
dst: Destination remote
|
768
789
|
args: Additional command-line arguments
|
769
|
-
|
790
|
+
|
770
791
|
Returns:
|
771
792
|
CompletedProcess with the result of the copy operation
|
772
793
|
"""
|
@@ -782,20 +803,20 @@ class Rclone:
|
|
782
803
|
) -> Exception | None:
|
783
804
|
"""
|
784
805
|
Copy a large file to S3 with resumable upload capability.
|
785
|
-
|
806
|
+
|
786
807
|
This method splits the file into parts for parallel upload and can
|
787
808
|
resume interrupted transfers using a custom algorithm in python.
|
788
|
-
|
809
|
+
|
789
810
|
Particularly useful for very large files where network interruptions
|
790
811
|
are likely.
|
791
|
-
|
812
|
+
|
792
813
|
Args:
|
793
814
|
src: Source file path (format: remote:bucket/path/file)
|
794
815
|
dst: Destination file path (format: remote:bucket/path/file)
|
795
816
|
part_infos: Optional list of part information for resuming uploads
|
796
817
|
upload_threads: Number of parallel upload threads
|
797
818
|
merge_threads: Number of threads for merging uploaded parts
|
798
|
-
|
819
|
+
|
799
820
|
Returns:
|
800
821
|
None if successful, Exception if an error occurred
|
801
822
|
"""
|
@@ -812,6 +833,7 @@ class Rclone:
|
|
812
833
|
src: Remote | Dir | str,
|
813
834
|
outdir: Path,
|
814
835
|
allow_writes: bool | None = False,
|
836
|
+
transfers: int | None = None, # number of writes to perform in parallel
|
815
837
|
use_links: bool | None = None,
|
816
838
|
vfs_cache_mode: str | None = None,
|
817
839
|
verbose: bool | None = None,
|
@@ -822,13 +844,14 @@ class Rclone:
|
|
822
844
|
) -> Mount:
|
823
845
|
"""
|
824
846
|
Mount a remote or directory to a local path.
|
825
|
-
|
847
|
+
|
826
848
|
Makes remote storage accessible as a local filesystem.
|
827
|
-
|
849
|
+
|
828
850
|
Args:
|
829
851
|
src: Remote or directory to mount
|
830
852
|
outdir: Local path to mount to
|
831
853
|
allow_writes: Whether to allow write operations
|
854
|
+
transfers: Number of parallel write operations
|
832
855
|
use_links: Whether to use symbolic links
|
833
856
|
vfs_cache_mode: VFS cache mode (e.g., "full", "minimal")
|
834
857
|
verbose: Whether to show detailed output
|
@@ -836,7 +859,7 @@ class Rclone:
|
|
836
859
|
cache_dir_delete_on_exit: Whether to delete cache on exit
|
837
860
|
log: Path to write logs to
|
838
861
|
other_args: Additional command-line arguments
|
839
|
-
|
862
|
+
|
840
863
|
Returns:
|
841
864
|
Mount object representing the mounted filesystem
|
842
865
|
"""
|
@@ -844,6 +867,7 @@ class Rclone:
|
|
844
867
|
src=src,
|
845
868
|
outdir=outdir,
|
846
869
|
allow_writes=allow_writes,
|
870
|
+
transfers=transfers,
|
847
871
|
use_links=use_links,
|
848
872
|
vfs_cache_mode=vfs_cache_mode,
|
849
873
|
verbose=verbose,
|
@@ -861,19 +885,19 @@ class Rclone:
|
|
861
885
|
) -> HttpServer:
|
862
886
|
"""
|
863
887
|
Serve a remote or directory via HTTP.
|
864
|
-
|
888
|
+
|
865
889
|
Creates an HTTP server that provides access to the specified remote.
|
866
890
|
The returned HttpServer object includes a client for fetching files.
|
867
|
-
|
891
|
+
|
868
892
|
This is useful for providing web access to remote storage or for
|
869
893
|
accessing remote files from applications that support HTTP but not
|
870
894
|
the remote's native protocol.
|
871
|
-
|
895
|
+
|
872
896
|
Args:
|
873
897
|
src: Remote or directory to serve
|
874
898
|
addr: Network address and port to serve on (default: localhost:8080)
|
875
899
|
other_args: Additional arguments to pass to rclone
|
876
|
-
|
900
|
+
|
877
901
|
Returns:
|
878
902
|
HttpServer object with methods for accessing the served content
|
879
903
|
"""
|
@@ -890,9 +914,9 @@ class Rclone:
|
|
890
914
|
) -> SizeResult | Exception:
|
891
915
|
"""
|
892
916
|
Get the size of a list of files.
|
893
|
-
|
917
|
+
|
894
918
|
Calculates the total size of the specified files.
|
895
|
-
|
919
|
+
|
896
920
|
Args:
|
897
921
|
src: Base path for the files
|
898
922
|
files: List of file paths relative to src
|
@@ -900,10 +924,10 @@ class Rclone:
|
|
900
924
|
other_args: Additional command-line arguments
|
901
925
|
check: Whether to verify file integrity
|
902
926
|
verbose: Whether to show detailed output
|
903
|
-
|
927
|
+
|
904
928
|
Returns:
|
905
929
|
SizeResult with size information, or Exception if an error occurred
|
906
|
-
|
930
|
+
|
907
931
|
Example:
|
908
932
|
size_files("remote:bucket", ["path/to/file1", "path/to/file2"])
|
909
933
|
"""
|
@@ -919,10 +943,10 @@ class Rclone:
|
|
919
943
|
def size_file(self, src: str) -> SizeSuffix | Exception:
|
920
944
|
"""
|
921
945
|
Get the size of a file.
|
922
|
-
|
946
|
+
|
923
947
|
Args:
|
924
948
|
src: Path to the file
|
925
|
-
|
949
|
+
|
926
950
|
Returns:
|
927
951
|
SizeSuffix object representing the file size, or Exception if an error occurred
|
928
952
|
"""
|