python的rclone包装器
python-rclone的Python项目详细描述
python rclone
用于rclone的python包装器。
rclone
必须已经是installed,并且可以在$PATH
中发现。
状态
正在工作。实验性的。
用法
importrclonecfg="""[local]type = localnounc = true"""result=rclone.with_config(cfg).listremotes()print(result.get('out'))# b'local:\n'print(result.get('code'))# 0print(result.get('error'))
执行的命令:
copy
将文件从源复制到目标,跳过已复制的文件sync
使源和目标相同,只修改目标。listremotes
列出配置文件中的所有远程。ls
列出路径中具有大小和路径的对象。lsjson
以json格式列出路径中的目录和对象。delete
删除路径的内容。
即使并非所有的rclone
命令都已公开,也可以直接使用run_cmd
方法调用任何命令,如下面的示例所示:
importrclonecfg="""[local]type = localnounc = true"""result=rclone.with_config(cfg).run_cmd(command="lsd",extra_args=["local:/tmp","-v","--dry-run"])
记录和调试
要查看有关执行哪些命令或打印哪些其他消息的详细信息,可以启用日志记录,如下所示:
importlogginglogging.basicConfig(level=logging.DEBUG,format="%(asctime)s%(name)s [%(levelname)s]: %(message)s")importrclonecfg="""[local]type = localnounc = true"""result=rclone.with_config(cfg).listremotes()
开发人员指南
$ pip install -r requirements.txt
$ make test