转载请注明:@小五义http://www.cnblogs.com/xiaowuyiQQ群: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同步百度云的更多相关文章

  1. 树莓派学习笔记——USB wifi配置指南

    0 前言     树莓派既能够使用有线网络又能够无线网络,假设使用有线网络不方便的话能够借助USB wifi无线网卡让树莓派也插上无线"翅膀". 可是和使用有线网络即插即用的方式不 ...

  2. 树莓派学习笔记(5):成功实现NAS家庭服务器(流媒体播放、文件共享及下载机)

    转载请注明:@小五义http://www.cnblogs.com/xiaowuyiQQ群:64770604 一.家庭服务器实现的主要功能 1.流媒体播放服务:利用DLNA实现电视.手机.电脑播放其上面 ...

  3. 树莓派学习笔记——交叉编译练习之SQLite3安装

    0.前言     本博文可能并没有太多使用价值.不过为了练习而练习.在树莓派上使用SQLite有非常多的方法,安装的方法也有非常多.     [1]假设使用Python,那么不必安装SQLite由于P ...

  4. 【转】树莓派学习笔记——I2C Tools 学习笔记

    原文网址:http://blog.csdn.net/xukai871105/article/details/15029843 1.安装     I2C驱动载入和速率修改请查看博文[树莓派学习笔记——I ...

  5. 【转】 树莓派学习笔记——I2C设备载入和速率设置

    原文网址:http://blog.csdn.net/xukai871105/article/details/18234075 1.载入设备 方法1——临时载入设备 sudo modprobe -r i ...

  6. 树莓派学习笔记——使用文件IO操作GPIO SysFs方式

    0 前言     本文描写叙述假设通过文件IO sysfs方式控制树莓派 GPIO端口.通过sysfs方式控制GPIO,先訪问/sys/class/gpio文件夹,向export文件写入GPIO编号, ...

  7. 树莓派学习笔记——apt方式安装opencv

    0.前言     本文介绍怎样在树莓派中通过apt方式安装opencv.并通过一个简单的样例说明怎样使用opencv. 相比于源码方式安装opencv,通过apt方式安装过程步骤简单些,消耗的时间也少 ...

  8. 树莓派学习笔记——I2C设备载入和速率设置

    原文:http://blog.csdn.net/xukai871105/article/details/18234075 1.载入设备 方法1——临时载入设备 sudo modprobe -r i2c ...

  9. 树莓派学习笔记—— 源码方式安装opencv

    0.前言     本文介绍怎样在树莓派中通过编译源码的方式安装opencv,并通过一个简单的样例说明怎样使用opencv.     很多其它内容请參考--[树莓派学习笔记--索引博文] 1.下载若干依 ...

随机推荐

  1. 关于git的一个错误提示

    一般clone仓库后如果,remote -v或者add出现如下的错误的话: Not a git repository (or any of the parent directories): .git需 ...

  2. javasript中var、let和const区别

    let和const都是es5,es6新版本的js语言规范出来的定义,在这以前定义一个变量只能用var.let和const都是为了弥补var的一些缺陷而新设计出来的. 简单来说是: let是修复了var ...

  3. python字典按照value进行排序

    先说几个解决的方法,具体的有时间再细说 d = {'a':1,'b':4,'c':2} 字典是这个,然后要对字典按照value进行排序 方法一: sorted(d.items(),key = lamb ...

  4. Python 字符编码简记

    名称 说明 ASCII 只能存英文和拉丁字符,一个字符占一个字节,8位. ASCII 码是不支持中文的,支持中文的第一张表是 GB2312 GB2312 支持中文,收录了 7445个字符 GBK1.0 ...

  5. GIS性能策略

    当一个地理平台上线运行,我们经常会遇到这些问题:1.系统刚上线时速度较快,一段时间后访问较慢?2.在地理平台目前的配置下,发布多少个服务才合理?一个服务配置多少个实例数才合适?这些问题,都涉及整个地理 ...

  6. Ubuntu 16.04.4 LTS + Ambari 2.6.1.5 + HDP 2.6.4.0 安装部署

    服务器 主机名 master slave1 slave2 slave3 IP 192.168.1.40 192.168.1.41 192.168.1.42 192.168.1.43 离线包服务器: 1 ...

  7. 安全测试 WEB安全测试手册

    WEB安全测试手册 By:授客 QQ:1033553122 欢迎加入软件性能测试交流QQ群:7156436 概述 Ø          目的 Ø          适用读者 Ø          适用 ...

  8. Java并发编程(七)深入剖析ThreadLocal

    一.对ThreadLocal的理解 ThreadLocal,很多地方叫做线程本地变量,也有些地方叫做线程本地存储,其实意思差不多.可能很多朋友都知道ThreadLocal为变量在每个线程中都创建了一个 ...

  9. CSS模糊效果及其兼容方法

    今天在整理IE滤镜时网站访问这里,居然找到模糊滤镜blur(),感觉太不可思议了,想不到IE居然会有这么多种滤镜效果,这基本上是模仿PS的.今天的重点是模糊滤镜 CSS模糊效果及其兼容方法 实例 兼容 ...

  10. ipa的plist文件查看

    1.ipa包解压缩:右键.ipa包,使用[归档实用工具/unarchiver]打开 2.进入解压缩后的payload目录,右键ipa包-显示包内容 3.找到info.plist文件,直接拖拽出来 4. ...