Linux命令行上传文件到百度网盘

系统环境:

Linux 系统 + Python 2.7

安装软件工具:

pip install requests
pip install bypy
授权登陆:

执行 bypy info,显示下边信息,根据提示,通过浏览器访问下边灰色的https链接,如果此时百度网盘账号正在登陆,会出现长串授权码,复制。

复制代码

bypy info

Please visit: # 访问下边这个连接,复制授权码
https://openapi.baidu.com/oauth/2.0/authorize?scope=basic+netdisk&redirect_uri=oob&response_type=code&client_id=q8WE4EpCsau1oS0MplgMKNBn
And authorize this app
Paste the Authorization Code here within 10 minutes.
Press [Enter] when you are done # 提示在下边粘贴授权码
复制代码
在下边图示红色位置粘贴授权码,耐心等待一会即可(1-2分钟)

复制代码
Press [Enter] when you are done
a288f3d775fa905a6911692a0808f6a8
Authorizing, please be patient, it may take upto None seconds…
Authorizing/refreshing with the OpenShift server …
OpenShift server failed, authorizing/refreshing with the Heroku server …
Successfully authorized
Quota: 2.015TB
Used: 740.493GB
复制代码
授权成功。

测试上传和同步本地文件到云盘

由于百度PCS API权限限制,程序只能存取百度云端/apps/bypy目录下面的文件和目录。我们可以通过:

bypy list

/apps/bypy ($t $f $s $m $d):
把本地当前目录下的文件同步到百度云盘:

bypy upload

把云盘上的内容同步到本地:

bypy downdir

比较本地当前目录和云盘根目录,看是否一致,来判断是否同步成功:

bypy compare
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值