百度有2TB 存儲空間,在有第三方服務器的狀況下,不少東西不須要下載到本地,能夠直接使用服務轉存,這很是好。html
系統環境:api
Linux 系統 + Python 2.7瀏覽器
安裝軟件工具:【可能會要重複裝】bash
pip install requests
pip install setuptools
pip install bypy
source ~/.bashrc
受權登錄:服務器
執行 bypy info,顯示下邊信息,根據提示,經過瀏覽器訪問下邊灰色的https連接,若是此時百度網盤帳號正在登錄,會出現長串受權碼,複製。app
[root@ineedle
~]
# 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
受權成功。【若是有這步的話,就沒法實現開放存儲,可是它可用於在線的文件轉存,這個是有價值的,甚至vultr可讓主機離線】post
測試上傳和同步本地文件到雲盤測試
因爲百度PCS API權限限制,程序只能存取百度雲端/apps/bypy目錄下面的文件和目錄。咱們能夠經過:this
【目錄操做,然後由GUI直接轉,分享。這是比較好的套路】
[root@ineedle
~]
# bypy list
/apps
/bypy ($t $f $s $m $d)
:
把本地當前目錄下的文件同步到百度雲盤:( 這個比較簡單了,可是也是能夠用的)
# bypy upload
把雲盤上的內容同步到本地:
# bypy downdir
比較本地當前目錄和雲盤根目錄,看是否一致,來判斷是否同步成功: