日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

树莓派学习笔记(7):利用bypy实现树莓派NAS同步百度云

發布時間:2025/5/22 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 树莓派学习笔记(7):利用bypy实现树莓派NAS同步百度云 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

轉載請注明:@小五義http://www.cnblogs.com/xiaowuyi??QQ群:64770604

樹莓派制作NAS過程詳見http://www.cnblogs.com/xiaowuyi/p/4051238.html。

?

Bypy是一個百度云/百度網盤的Python客戶端,主要的目的就是在Linux環境下(命令行)同步百度云盤空間。Bypy要求python2.7以上版本,最新版下載地址為https://github.com/houtianze/bypy

一、bypy安裝

1、所需環境

python 2.7x

python requests庫(安裝該庫需要setuptools 和pip)

2、安裝

(1)python 2.7 不在詳述

(2)requests庫安裝

首先安裝setuptools

wget https://bootstrap.pypa.io/ez_setup.py -O - | python

如果安裝過程中出現問題,可能是沒有安裝zip解壓的原因,zip如何安裝請百度。

然后安裝pip

https://pypi.python.org/pypi/pip 從這里下載pip-1.5.6.tar.gz

tar -zxvf pip-1.5.6.tar.gz

python setup.py install

安裝完成后,pip install requests。實現requests的安裝。

(3)安裝bypy

直接從https://github.com/houtianze/bypy下載解壓就可以了。

3、使用

(1)第一次使用

要把系統的區域編碼設置為UTF-8

vi /etc/sysconfig/i18n
將原內容改為:

LANG="zh_CN.UTF-8"
SYSFONT=latarcyrheb-sun16

設置token:

./bypy.py info

程序會要求你訪問一個網址,獲取你授權碼,授權后復制code給程序,程序會利用不同的服務器進行認證,認證成功會顯示百度網盤的容量,如果一次沒成功,可以多試幾次,容易被墻。

這時百度網盤的“我的應用管理”下會形成bypy文件+。

安裝完全后,可以使用./bypy.py list 來看一下列表。

(2)主要命令參數

optional arguments:
? -h, --help??????????? show this help message and exit
? --TESTRUN???????????? Perform python doctest [default: False]
? --PROFILE???????????? Profile the code [default: False]
? -V, --version???????? show program's version number and exit
? -d, --debug?????????? enable debugging & logging [default: 0]
? -v, --verbose???????? set verbosity level [default: 0]
? -r RETRY, --retry RETRY
??????????????????????? number of retry attempts on network error [default: 5
??????????????????????? times]
? -q QUIT, --quit-when-fail QUIT
??????????????????????? quit when maximum number of retry failed [default:
??????????????????????? False]
? -t TIMEOUT, --timeout TIMEOUT
??????????????????????? network timeout in seconds [default: 60]
? -s SLICE, --slice SLICE
??????????????????????? size of file upload slice (can use '1024', '2k',
??????????????????????? '3MB', etc) [default: 20 MB]
? --chunk CHUNK???????? size of file download chunk (can use '1024', '2k',
??????????????????????? '3MB', etc) [default: 20 MB]
? -e, --verify????????? Verify upload / download [default : False]
? -f, --force-hash????? force file MD5 / CRC32 calculation instead of using
??????????????????????? cached values [default: False]
? -l LISTFILE, --list-file LISTFILE
??????????????????????? input list file (used by some of the commands only
??????????????????????? [default: None]
? --resume-download RESUMEDL
??????????????????????? resume instead of restarting when downloading if local
??????????????????????? file already exists [default: True]
? --include-regex INCREGEX
??????????????????????? regular expression of files to include. if not
??????????????????????? specified (default), everything is included. for
??????????????????????? download, the regex applies to the remote files; for
??????????????????????? upload, the regex applies to the local files. to
??????????????????????? exclude files, think about your regex, some tips here:
??????????????????????? https://stackoverflow.com/questions/406230/regular-
??????????????????????? expression-to-match-string-not-containing-a-word
??????????????????????? [default: ]
? --on-dup ONDUP??????? what to do when the same file / folder exists in the
??????????????????????? destination: 'overwrite', 'skip', 'prompt' [default:
??????????????????????? overwrite]
? --no-symlink????????? DON'T follow symbol links when uploading / syncing up
??????????????????????? [default: True]
? --disable-ssl-check?? DON'T verify host SSL cerificate [default: True]
? -c, --clean?????????? 1: clean settings (remove the token file) 2: clean
??????????????????????? settings and hash cache [default: 0]

Commands:
help command - provide some information for the command
cleancache - remove invalid entries from hash cache file
combine <remotefile> [md5s] [localfile] - try to create a file at PCS by combining slices, having MD5s specified
compare [remotedir] [localdir] - compare the remote direcotry with the local directory
copy/cp <from> <to> - copy a file / dir remotely at Baidu Yun
delete/remove/rm <remotepath> - delete a file / dir remotely at Baidu Yun
downdir <remotedir> [localdir] - download a remote directory (recursively)
downfile <remotefile> [localpath] - download a remote file.
dumpcache - display file hash cache
list/ls [remotepath] [format] [sort] [order] - list the 'remotepath' directory at Baidu PCS
listrecycle [start] [limit] - list the recycle contents
meta <remotepath> [format] - get information of the given path (dir / file) at Baidu Yun.
mkdir <remotedir> - create a directory at Baidu Yun
move/mv/rename/ren <from> <to> - move a file / dir remotely at Baidu Yun
quota/info - displays the quota information
refreshtoken - refresh the access token
restore <remotepath> - restore a file from the recycle bin
search <keyword> [remotepath] [recursive] - search for a file using keyword at Baidu Yun
stream <remotefile> <localpipe> [format] [chunk] - stream a video / audio file converted to M3U format at cloud side, to a pipe.
syncdown [remotedir] [localdir] [deletelocal] - sync down from the remote direcotry to the local directory
syncup [localdir] [remotedir] [deleteremote] - sync up from the local direcotry to the remote directory
upload [localpath] [remotepath] [ondup] - upload a file or directory (recursively)

?

總結

以上是生活随笔為你收集整理的树莓派学习笔记(7):利用bypy实现树莓派NAS同步百度云的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。