cloud sync支持与各种云提供商进行简单的云文件级同步

cloudsync的Python项目详细描述


云同步

python云同步库

pip install cloudsync

示例:

from cloudsync import CloudSync, CloudSyncProvider

local = CloudSyncProvider("local", path="/usr/home/alice/test", monitor=True)

remote = CloudSyncProvider("gdrive", path="/test-folder")

remote.connect()

sync = CloudSync(local, remote)

sync.start()

with open("/usr/home/alice/test/hello.txt", "w") as f:
    f.write("hello")

# give the monitor a second to notice the change
# alternatively we can "poke" the local provider, forcing a sync

time.sleep(1)

sync.wait(timeout=10)

# using no_poke to deliberately trick our sync into *not* knowing about the rename 
remote.rename("/test-folder/hello.txt", "/test-folder/goodbye.txt", no_poke=True)

# we should still sync properly because of the event cursor
while not os.path.exists("/usr/home/alice/test/goodbye.txt"):
    time.sleep(1)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android ListView显示的数字不超过8位   java什么导致警告“Classpath entry/XXX/XXX.jar将不会导出或发布。可能会导致运行时ClassNotFoundException。”   java使用Spring容器在非Spring对象上调用方法,允许参数连接?   java Android:当另一个手指已经在触摸屏幕时,是否可以处理一次点击?   java Veil加载JFrame上的图像或加载面板   JavaSpring没有为Redis缓存上的记录设置过期时间   java异常:SparkException:任务不可序列化   java Android studio用户注册数据未插入firebase数据库   java在StackPane中的区域图上覆盖节点   java获取活动UI的“会话已过期”消息   java组织。冬眠MappingNotFoundException:资源:*hbm。找不到xml   java Mockito mock在尝试存根包保护的方法时调用实方法实现