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

转载请注明:@小五义http://www.cnblogs.com/xiaowuyi  QQ群:64770604html

树莓派制做NAS过程详见http://www.cnblogs.com/xiaowuyi/p/4051238.html。
python

 

Bypy是一个百度云/百度网盘的Python客户端,主要的目的就是在Linux环境下(命令行)同步百度云盘空间。Bypy要求python2.7以上版本,最新版下载地址为https://github.com/houtianze/bypygit

1、bypy安装github

一、所需环境express

python 2.7xbootstrap

python requests库(安装该库须要setuptools 和pip)服务器

二、安装app

(1)python 2.7 不在详述python2.7

(2)requests库安装ide

首先安装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下载解压就能够了。

三、使用

(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 commandcleancache - remove invalid entries from hash cache filecombine <remotefile> [md5s] [localfile] - try to create a file at PCS by combining slices, having MD5s specifiedcompare [remotedir] [localdir] - compare the remote direcotry with the local directorycopy/cp <from> <to> - copy a file / dir remotely at Baidu Yundelete/remove/rm <remotepath> - delete a file / dir remotely at Baidu Yundowndir <remotedir> [localdir] - download a remote directory (recursively)downfile <remotefile> [localpath] - download a remote file.dumpcache - display file hash cachelist/ls [remotepath] [format] [sort] [order] - list the 'remotepath' directory at Baidu PCSlistrecycle [start] [limit] - list the recycle contentsmeta <remotepath> [format] - get information of the given path (dir / file) at Baidu Yun.mkdir <remotedir> - create a directory at Baidu Yunmove/mv/rename/ren <from> <to> - move a file / dir remotely at Baidu Yunquota/info - displays the quota informationrefreshtoken - refresh the access tokenrestore <remotepath> - restore a file from the recycle binsearch <keyword> [remotepath] [recursive] - search for a file using keyword at Baidu Yunstream <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 directorysyncup [localdir] [remotedir] [deleteremote] - sync up from the local direcotry to the remote directoryupload [localpath] [remotepath] [ondup] - upload a file or directory (recursively)

相关文章
相关标签/搜索