houtianze / bypy

Python client for Baidu Yun (Personal Cloud Storage) 百度云/百度网盘Python客户端
MIT License
7.86k stars 1.4k forks source link

授权回车后无反应 #2

Closed chaopeng closed 10 years ago

chaopeng commented 10 years ago
./bypy.py list -d

Token file: '/home/****/.bypy.json'
Hash Cache file: '/home/****/.bypy.pickle'
App root path at Baidu Yun '/apps/bypy'
sys.stdin.encoding = UTF-8
sys.stdout.encoding = UTF-8
----

<E> [14:59:02] Error while loading baidu pcs token:
<E> [14:59:02] Traceback (most recent call last):
  File "./bypy.py", line 905, in __load_local_json
    with open(TokenFilePath, 'rb') as infile:
IOError: [Errno 2] No such file or directory: u'/home/chao/.bypy.json'

Please visit:
https://openapi.baidu.com/oauth/2.0/authorize?scope=basic+netdisk&redirect_uri=oob&response_type=code&client_id=********************
And authorize this app
Paste the Authorization Code here and then press [Enter] within 10 minutes.
ff********************2
<D> auth_code: ff********************2
<D> GET http://bypyoauth.appspot.com/auth
<D> actargs: None
<D> Params: {u'code': 'ff********************2', u'redirect_uri': u'oob'}
houtianze commented 10 years ago

会不会是 http://bypyoauth.appspot.com/ 被墙了? 试试用浏览器能不能访问:http://bypyoauth.appspot.com/273ed5ce9831b6dd6fd33265edfc1570 如果不能,可能是被墙了。

chaopeng commented 10 years ago

墙了。。。

chaopeng commented 10 years ago

翻墙拿了授权 上传报错

/bypy.py syncup /home/**/yun / -d
Token file: '/home/**/.bypy.json'
Hash Cache file: '/home/**/.bypy.pickle'
App root path at Baidu Yun '/apps/bypy'
sys.stdin.encoding = UTF-8
sys.stdout.encoding = UTF-8
----

<D> Token loaded:
<D> {u'access_token': u'21.17**************************92000.1396079324.4111405634-1572671', u'expires_in': 2592000, u'session_secret': u'c7aa*************88f4621f417b4', u'scope': u'basic netdisk', u'session_key': u'9mnRda6C**********************************Tg==', u'refresh_token': u'2*******************************************572671'}
<D> [16:03:02] Cache hit for file '/home/***/yun/1.txt',
md5: dd75ed975639f27bca44b3ad129552bc
size: 13
mtime: 1393487877
<D> F - 1.txt - size: 13 - md5: dd75ed975639f27bca44b3ad129552bc 

<D> GET https://pcs.baidu.com/rest/2.0/pcs/file
<D> actargs: ([], [])
<D> Params: {u'path': u'/apps/bypy', u'order': u'asc', u'method': u'list', u'by': u'name'}
<D> HTTP Status Code: 200
<D> Request OK, processing action
<D> Request all goes fine
<D> Remote dirs: []
<D> Remote files: []
<D> ---- Remote Dir Contents ---
<D> 
<D> '/home/**/yun/1.txt' is small and being non-slicing uploaded.
<D> POST https://c.pcs.baidu.com/rest/2.0/pcs/file
<D> actargs: /apps/bypy/1.txt
<D> Params: {u'path': u'/apps/bypy/1.txt', u'ondup': u'overwrite', u'method': u'upload'}
<E> [16:03:07] Error accessing 'https://c.pcs.baidu.com/rest/2.0/pcs/file'
<E> [16:03:07] Exception: [Errno 1] _ssl.c:509: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Traceback (most recent call last):
  File "./bypy.py", line 804, in __request_work
    params = parsnew, timeout = self.__timeout, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 88, in post
    return request('post', url, data=data, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 335, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 438, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 331, in send
    raise SSLError(e)
SSLError: [Errno 1] _ssl.c:509: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
houtianze commented 10 years ago

贴下你的uname -a输出?

chaopeng commented 10 years ago

Linux ***-note 3.11.0-17-generic #31-Ubuntu SMP Mon Feb 3 21:52:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

houtianze commented 10 years ago

哦,大概猜到了。 你还在翻墙(GoAgent?)状态跑吧?一旦拿到授权(得到~/.bypy.json),你就不用翻墙跑了。试试退出翻墙状态再跑? 如果是用GoAgent,问题应该出在他那个证书不是被信任的。

houtianze commented 10 years ago

如果还不行,按照这个问答: https://stackoverflow.com/questions/17084886/ssl-error-routinesssl3-get-server-certificatecertificate-verify-failed

你搜索request.get和requests.post函数调用,在参数里面加上verify=False应该可以解决这个问题吧。

暂时不想改动是因为百度的证书是没问题的。

chaopeng commented 10 years ago

goagent是关掉了,改verify=False可以,但是总觉得有点不科学。。。

houtianze commented 10 years ago

是啊,我也觉得不科学,这个问题我从来没遇见过。你试下用浏览器直接访问:https://c.pcs.baidu.com/rest/2.0/pcs/file 会有证书警告吗?

chaopeng commented 10 years ago

没有警告

heimi commented 10 years ago

这个东西可以放在国内吗?

houtianze commented 10 years ago

可以考虑,国内哪个好一些?sae, bae? 访问量不大,一个访问就一两个HTTP 请求,免费的账号够用不?谁有经验?

墙有点深井,我在两个地方试过可以的,但貌似很多地方还是不行。。

heimi commented 10 years ago

嗯, sae免费的绝对够用

houtianze commented 10 years ago

@heimi 这样啊,好的,我去看看。 谢谢推荐。

heimi commented 10 years ago

开通PCS API权限难审核吗?

houtianze commented 10 years ago

当初根本不用审核,直接网页点两下就可以了。现在好像百度暂时不给申请了,说是调整中。

huangchanghu commented 10 years ago

能快点迁个地方吗?不能用啊,翻墙了还是不成功

houtianze commented 10 years ago

好吧,我尽量快点迁移了,现在还刚刚开始熟悉bae的环境。好像openshift.com也可以考虑,谁知道在上面搭建的网站墙了没? 翻了墙还不能用?能贴下bypy.py -d -v quota的输出吗?

huangchanghu commented 10 years ago

@houtianze 现在翻墙后可以了,是我的vpn的问题 另外发现下载文件有点问题:

houtianze commented 10 years ago

@huangchanghu

huangchanghu commented 10 years ago

我测的是下载一个视频文件,我强制停止的时候内存占用500多兆了

houtianze notifications@github.com编写:

@huangchanghu

是先到内存,但应该不会占用很多,缺省是10M一存,内纯用量超过很多吗?不过我主要上传了,没怎么测试大文件下载。单个文件下载现在是没有进度的,不过下载一个目录,加-v应该会显示下载的文件。

— Reply to this email directly or view it on GitHub.

houtianze commented 10 years ago

这样的啊,看来是个大bug,我去看看。

houtianze commented 10 years ago

@huangchanghu 下载狂吃内存的bug应该解决了。调试输出代码造成。。

huangchanghu commented 10 years ago

@houtianze 试了,ok了。很赞~~加油哈,希望后续更完善些。比如可以借鉴借鉴迅雷离线的这个项目:iambus / xunlei-lixian

houtianze commented 10 years ago

好的,谢谢鼓励:) 准备把授权部分搬移到不被墙的服务器上去。

houtianze commented 10 years ago

加了一个现在貌似还未被墙的服务器,暂时墙内应该可以用了。