安装 bypy
安装软件工具
pip install requests
pip install bypypip安装依赖于requests库失败的解决防范:pip install bypy --upgrade --ignore-installed requests
授权百度云openapi
执行bypy info命令,根据提示,通过浏览器访问百度openapi链接,如果此时百度网盘账号正在登陆,会出现长串授权码,进行复制。
# 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
复制授权码
粘贴到对应命令行提示下方位置,回车等待,提示认证授权成功。
常用命令
bypy常用命令:
bypy list #查看目录
bypy mkdir #新建目录
bypy upload filename 上传文档
bypy downdir #把云盘上的内容同步到本地
bypy -c #取消令牌文件
上传文件
如果要显示上传进度,可使用命令:
bypy -v upload localfile
上传文件举例:
# bypy -v upload web-dvwa.tar
下载文件
bypy的目录在【我的网盘】->【我的应用数据】->【bypy】中,所以需要将准备下载的文件放到bypy目录下。
bypy list 查看bypy目录中的文件
bypy downfile filename 下载文件
参考链接