Package: pyclone-module
PycloneRclone for your python environment and your virtual environment.Comes bundled with the Rclone binary so, no need to have Rclone pre-installed.InstallationThe installation automatically downloads the rclone binaries so there is no prerequisite to having rclone prior.Run the following to install:pipinstallpyclone-moduleConfigurationIf you already have the rclone pre-installed and want to use that specific binary you can set the paths using the thepyclone.set_path()method:importpyclonepyclone.set_path(path=PATH_TO_RCLONE,config=PATH_TO_CONFIG)UsageCLIPyclone is a wrapper or rclone, so you can use the same commands you regularly use in rclone. Visit rclone.org/commands for further information.user:~$pycloneconfigImport Pyclone into your projectsImporting pyclone into your projects to have programatic control ofrcloneis as simple asimport pyclone. Further usage will require some knowlegde on some of the classes.importpyclonepyc=pyclone.Pyclone()Pyclone classesThere are three major classes in Pyclone:pyclone.Pyclone()pyclone.RemoteManager()pyclone.Remote()1. pyclone.Pyclone()This is the main pyclone object that is ressponsible for communicating with theRcloneshell. You will be dealing with this class mostly. Instanitate it like thisimportpyclonepyc=pyclone.Pyclone()1.1 pyclone.Pyclone().execute(command)Pyclone utilizes thesubprocessmodule to communicate with the shell and theexecutemethod allows you to send commands directly to rclone. Commands have to are expected to be inlistformat. This returns aResponseobject which contains thetext,stdout,stderr,responsecodeandargsinstance variables.>>>importpyclone>>>command=['help']>>>pyc=pyclone.Pyclone()>>>response=pyc.execute(command)>>>print(reponse.responsecode)0>>>print(repsponse.text)Ommited........1.2 Create a Remotepyc.config_create()importpyclonepyc=pyclone.Pyclone()pyc.config_create('remote_type','remote_name','remote@email.com','remote_pass')1.3 Delete a remotepyc.config_delete()pyc.config_delete('remote_name')1.4 Move/Copypyc.copy()/pyc.move()Notethat the the remote has to be appended by a colon at the end which will end up looking like:
pyc.copy(file.zip, 'remote:')pyc.copy('src:path','dest:path')pyc.move('src:path','dest:path')1.5 List directory (ls)pyc.copy()/pyc.move()pyc.ls('remote:path')Using the Remote Manager and Remote object2 pyclone.RemoteManager()The Remote Mangager brings everything together by mangaing your remotes, and extending the functionality of the Pyclone and Remote objects.>>>importpyclone>>>remotes=pyclone.RemoteManager()>>>remotes.show()['remote_A','remote_B']1.2 Create/Deleting a Remoteremotes.create()/remotes.delete()remotes.create('remote_type','remote_name','remote@email.com','remote_pass')remotes.delete('remote_name')Remote Objects2.1 Get a Remoteremotes.get_remote()This returns aRemoteobject that inherits most of its functionality from the Pyclone object.remote_A=remotes.get_remote('remote_A')2.2 Remote methodsremote.ls()remote.copy('file', dl=False)Ifdl=Truethis will download the file from the remote.remote.move('file:path', dl=False)Ifdl=Truethis will download the file from the remote.remote.delete('file:path')remote.size()Future:Non-blocking subprocessespyclone.Remote.check()Developing pycloneTo install pyclone, along with all the tools you need to develop and run tests, run the following in your virtualenv:user:~$pipinstall-e.[dev]Drop some feedback, bugs, and feature requests if you can.