Linux upload file to Baidu cloud disk

Server environment

1
2
3
4
5
6
7
8
$ cat /etc/issue
Ubuntu 16.04.2 LTS

$ pip -V
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

$ php -v
PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )

Install bypy

1
$ pip install requests bypy

Authorized Login

1
2
3
4
5
6
$ 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

Visit the url then copy the code in terminal and entry

1
bc773b9b3884019d284b59c21fccf449

1
2
3
4
5
6
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.008TB
Used: 192.089GB

Authorized success.

1
2
$ bypy list
/apps/bypy ($t $f $s $m $d):

Limited by Baidu PCS api, files just can be accessed under the /apps/bypy directory in Baidu cloud disk

Upload to cloud disk

1
2
3
$ cd ~/data/
$ bypy upload
[____________________] 0% (85.2MB/1.3GB)

All files under the data directory are uploading.

Download file from cloud disk

1
$ bypy downdir

Files under the directory /apps/bypy will be downloaded now.

Thank you for reading.
This post is copyrighted by Liyuliang’s Blog.
If reproduced, please indicate the source: Liyuliang’s Blog
This blog uses Creative Commons Attribution-NonCommercial-Share-Sharing 4.0 International License Agreement to license.


Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×