rclone-python-lp-asset


Namerclone-python-lp-asset JSON
Version 0.1.13 PyPI version JSON
download
home_pagehttps://github.com/ligeng8848/rclone_python
SummaryA python wrapper for rclone.
upload_time2024-02-20 08:39:56
maintainer
docs_urlNone
authorJohannes Gundlach
requires_python>=3.6
license
keywords rclone wrapper cloud sync
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)
[![PyPI version](https://badge.fury.io/py/rclone-python.svg)](https://badge.fury.io/py/rclone-python)

# rclone-python ☁️

A python wrapper for rclone that makes rclone's functionality usable in python.
rclone needs to be installed on the system for the wrapper to work.

![demo gif](https://raw.githubusercontent.com/Johannes11833/rclone_python/master/demo/demo.gif)

## Features βš’οΈ

- Copy, move and sync files between remotes
- Delete and prune files/directories
- List files in a directory including properties of the files.
- List available remotes.
- Generate hashes from files or validate them with their hashsum.
- Create new remotes
- Check available remotes
- Create and manage public links.
- Check the currently installed rclone versions and if updates are available.

## Installation πŸ’Ύ

_rclone_python_ can be installed using pip

```shell
pip install rclone-python
```

or by cloning this repository and running from within the root of the project

```shell
pip install .
```

## How to use πŸ’‘

All functionally of this wrapper is accessible through `rclone`.
The following example checks if rclone is installed.

```python
from rclone_python import rclone

print(rclone.is_installed())
```

```console
True
```
### Create new remote

Create a new rclone remote connection with rclone's default client-id and client-secret.

```python
from rclone_python import rclone
from rclone_python.remote_types import RemoteTypes

rclone.create_remote('onedrive', RemoteTypes.onedrive)
```

Additionally, client-id and client-secret can be used with many cloud providers.

```python
from rclone_python import rclone
from rclone_python.remote_types import RemoteTypes

rclone.create_remote('onedrive', RemoteTypes.onedrive, client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET')
```

### Copy

```python
from rclone_python import rclone

# copy all file in the test_dir on OneDrive to the local data folder.
rclone.copy('onedrive:data', 'data', ignore_existing=True, args=['--create-empty-src-dirs'])
```


```console
Copying onedrive:data to data β Έ ━━━━━━━━━━━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━  47% 110.0/236.5 MiB 0:00:04
 β”œβ”€video1.webm                β Έ ━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━  31% 24.4/78.8 MiB   0:00:06
 β”œβ”€video2.webm                β Έ ━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━  45% 35.5/78.8 MiB   0:00:03
 └─video3.webm                β Έ ━━━━━━━━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━  35% 27.6/78.8 MiB   0:00:05
```

### Delete

Delete a file or a directory. When deleting a directory, only the files in the directory (and all it's subdirectories)
are deleted, but the folders remain.

```python
from rclone_python import rclone

# delete a specific file on onedrive
rclone.delete('onedrive:data/video1.mp4')

```

### Prune

```python
from rclone_python import rclone

# remove the entire test_dir folder (and all files contained in it and it's subdirectories) on onedrive
rclone.purge('onedrive:test_dir')
```

### Get Hash
```python
from rclone_python import rclone
from rclone_python.hash_types import HashTypes

print(rclone.hash(HashTypes.sha1, "box:data")
```
```console
{'video1.webm': '3ef08d895f25e8b7d84d3a1ac58f8f302e33058b', 'video3.webm': '3ef08d895f25e8b7d84d3a1ac58f8f302e33058b', 'video2.webm': '3ef08d895f25e8b7d84d3a1ac58f8f302e33058b'}
```

## Custom Progressbar
You can use your own rich progressbar with all transfer operations.
This allows you to customize the columns to be displayed.
A list of all rich-progress columns can be found [here](https://rich.readthedocs.io/en/stable/progress.html#columns).

```python
from rclone_python import rclone

from rich.progress import (
    Progress,
    TextColumn,
    BarColumn,
    TaskProgressColumn,
    TransferSpeedColumn,
)

pbar = Progress(
    TextColumn("[progress.description]{task.description}"),
    BarColumn(),
    TaskProgressColumn(),
    TransferSpeedColumn(),
)
rclone.copy("data", "box:rclone_test/data1", pbar=pbar)
```

```console
Copying data to data1 ━━━━━━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  17% 5.3 MB/s                                                                                                            
 β”œβ”€video1.mp4         ━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━  38% 4.2 MB/s                                                                                                            
 β”œβ”€video2.mp4         ━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   5% 1.6 MB/s
 └─another.mp4        ━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   4% 1.4 MB/s
```

## Debug
For debugging progress related functionality, set the DEBUG flag to true: 
```python
rclone.DEBUG = True
```
This will make the wrapper print the raw rclone progress. 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ligeng8848/rclone_python",
    "name": "rclone-python-lp-asset",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "rclone,wrapper,cloud sync",
    "author": "Johannes Gundlach",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/0e/62/f9172c1a07cf50b1df0934a024b10242b0ed09712569e1fe9f90966b0cc8/rclone-python-lp-asset-0.1.13.tar.gz",
    "platform": null,
    "description": "[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)\n[![PyPI version](https://badge.fury.io/py/rclone-python.svg)](https://badge.fury.io/py/rclone-python)\n\n# rclone-python \u2601\ufe0f\n\nA python wrapper for rclone that makes rclone's functionality usable in python.\nrclone needs to be installed on the system for the wrapper to work.\n\n![demo gif](https://raw.githubusercontent.com/Johannes11833/rclone_python/master/demo/demo.gif)\n\n## Features \u2692\ufe0f\n\n- Copy, move and sync files between remotes\n- Delete and prune files/directories\n- List files in a directory including properties of the files.\n- List available remotes.\n- Generate hashes from files or validate them with their hashsum.\n- Create new remotes\n- Check available remotes\n- Create and manage public links.\n- Check the currently installed rclone versions and if updates are available.\n\n## Installation \ud83d\udcbe\n\n_rclone_python_ can be installed using pip\n\n```shell\npip install rclone-python\n```\n\nor by cloning this repository and running from within the root of the project\n\n```shell\npip install .\n```\n\n## How to use \ud83d\udca1\n\nAll functionally of this wrapper is accessible through `rclone`.\nThe following example checks if rclone is installed.\n\n```python\nfrom rclone_python import rclone\n\nprint(rclone.is_installed())\n```\n\n```console\nTrue\n```\n### Create new remote\n\nCreate a new rclone remote connection with rclone's default client-id and client-secret.\n\n```python\nfrom rclone_python import rclone\nfrom rclone_python.remote_types import RemoteTypes\n\nrclone.create_remote('onedrive', RemoteTypes.onedrive)\n```\n\nAdditionally, client-id and client-secret can be used with many cloud providers.\n\n```python\nfrom rclone_python import rclone\nfrom rclone_python.remote_types import RemoteTypes\n\nrclone.create_remote('onedrive', RemoteTypes.onedrive, client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET')\n```\n\n### Copy\n\n```python\nfrom rclone_python import rclone\n\n# copy all file in the test_dir on OneDrive to the local data folder.\nrclone.copy('onedrive:data', 'data', ignore_existing=True, args=['--create-empty-src-dirs'])\n```\n\n\n```console\nCopying onedrive:data to data \u2838 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2578\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501  47% 110.0/236.5 MiB 0:00:04\n \u251c\u2500video1.webm                \u2838 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u257a\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501  31% 24.4/78.8 MiB   0:00:06\n \u251c\u2500video2.webm                \u2838 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u257a\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501  45% 35.5/78.8 MiB   0:00:03\n \u2514\u2500video3.webm                \u2838 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2578\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501  35% 27.6/78.8 MiB   0:00:05\n```\n\n### Delete\n\nDelete a file or a directory. When deleting a directory, only the files in the directory (and all it's subdirectories)\nare deleted, but the folders remain.\n\n```python\nfrom rclone_python import rclone\n\n# delete a specific file on onedrive\nrclone.delete('onedrive:data/video1.mp4')\n\n```\n\n### Prune\n\n```python\nfrom rclone_python import rclone\n\n# remove the entire test_dir folder (and all files contained in it and it's subdirectories) on onedrive\nrclone.purge('onedrive:test_dir')\n```\n\n### Get Hash\n```python\nfrom rclone_python import rclone\nfrom rclone_python.hash_types import HashTypes\n\nprint(rclone.hash(HashTypes.sha1, \"box:data\")\n```\n```console\n{'video1.webm': '3ef08d895f25e8b7d84d3a1ac58f8f302e33058b', 'video3.webm': '3ef08d895f25e8b7d84d3a1ac58f8f302e33058b', 'video2.webm': '3ef08d895f25e8b7d84d3a1ac58f8f302e33058b'}\n```\n\n## Custom Progressbar\nYou can use your own rich progressbar with all transfer operations.\nThis allows you to customize the columns to be displayed.\nA list of all rich-progress columns can be found [here](https://rich.readthedocs.io/en/stable/progress.html#columns).\n\n```python\nfrom rclone_python import rclone\n\nfrom rich.progress import (\n    Progress,\n    TextColumn,\n    BarColumn,\n    TaskProgressColumn,\n    TransferSpeedColumn,\n)\n\npbar = Progress(\n    TextColumn(\"[progress.description]{task.description}\"),\n    BarColumn(),\n    TaskProgressColumn(),\n    TransferSpeedColumn(),\n)\nrclone.copy(\"data\", \"box:rclone_test/data1\", pbar=pbar)\n```\n\n```console\nCopying data to data1 \u2501\u2501\u2501\u2501\u2501\u2501\u2578\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501  17% 5.3 MB/s                                                                                                            \n \u251c\u2500video1.mp4         \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u257a\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501  38% 4.2 MB/s                                                                                                            \n \u251c\u2500video2.mp4         \u2501\u2578\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501   5% 1.6 MB/s\n \u2514\u2500another.mp4        \u2501\u2578\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501   4% 1.4 MB/s\n```\n\n## Debug\nFor debugging progress related functionality, set the DEBUG flag to true: \n```python\nrclone.DEBUG = True\n```\nThis will make the wrapper print the raw rclone progress. \n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A python wrapper for rclone.",
    "version": "0.1.13",
    "project_urls": {
        "Homepage": "https://github.com/ligeng8848/rclone_python"
    },
    "split_keywords": [
        "rclone",
        "wrapper",
        "cloud sync"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f595ed8832e3dd0825f9816c92437291f0d79a3430715376dde10b8096c3f42",
                "md5": "f3c3529d7433d432bf2ec5859255a307",
                "sha256": "658092955fd37a9b854587832ae9ca7fcb2b405af5fa56393cbb65ba2eaae55e"
            },
            "downloads": -1,
            "filename": "rclone_python_lp_asset-0.1.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f3c3529d7433d432bf2ec5859255a307",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 13100,
            "upload_time": "2024-02-20T08:39:55",
            "upload_time_iso_8601": "2024-02-20T08:39:55.113219Z",
            "url": "https://files.pythonhosted.org/packages/9f/59/5ed8832e3dd0825f9816c92437291f0d79a3430715376dde10b8096c3f42/rclone_python_lp_asset-0.1.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e62f9172c1a07cf50b1df0934a024b10242b0ed09712569e1fe9f90966b0cc8",
                "md5": "70a86d6b93409a87c6a7b1a4db1f69c0",
                "sha256": "8f0e719f1a40d6f870f5b7864cbd40085adb95b96ceb4b9e9404b4f175fa3d0a"
            },
            "downloads": -1,
            "filename": "rclone-python-lp-asset-0.1.13.tar.gz",
            "has_sig": false,
            "md5_digest": "70a86d6b93409a87c6a7b1a4db1f69c0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13344,
            "upload_time": "2024-02-20T08:39:56",
            "upload_time_iso_8601": "2024-02-20T08:39:56.624493Z",
            "url": "https://files.pythonhosted.org/packages/0e/62/f9172c1a07cf50b1df0934a024b10242b0ed09712569e1fe9f90966b0cc8/rclone-python-lp-asset-0.1.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-20 08:39:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ligeng8848",
    "github_project": "rclone_python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "rclone-python-lp-asset"
}
        
Elapsed time: 0.42503s