ly0 / baidupcsapi

百度网盘api
MIT License
1.21k stars 234 forks source link

首次登陆时获取的bdstoken错误 #43

Open gaohuazuo opened 8 years ago

gaohuazuo commented 8 years ago

在没有cookies的情况下, PCS('username', 'password').user['token'] == 'the fisrt two args should be string type:0,1!'

修改BaseClass._initiate可以解决此问题https://github.com/ly0/baidupcsapi/compare/master...gaohuazuo:patch-1

ly0 commented 8 years ago

这个可以解决 #34 的-6问题么?

gaohuazuo commented 8 years ago

可以解决首次登录时的-6问题, 但是cookies过期后有其他问题

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/fuse.py", line 495, in _wrapper
    return func(*args, **kwargs) or 0
  File "/usr/local/lib/python2.7/dist-packages/fuse.py", line 693, in readdir
    fip.contents.fh):
  File "baidufuse.py", line 165, in readdir
    for file in foo['list']:
KeyError: 'list'
ly0 commented 8 years ago

你用的是baidu-fuse么,直接用这个库登录一下看看呢 ?

gaohuazuo commented 8 years ago

.username.cookies 没有保存domain, 重新登录之后导致冲突. 具体来说是self.session.cookies['BDUSS'] 会抛异常. https://github.com/gaohuazuo/baidupcsapi/commit/b3b34c27dd8809ab2f3e0526e7e7d39a6bc71573 https://github.com/gaohuazuo/baidupcsapi/commit/ba3a4dcf364bc13a5181c7cf8185ca43cd7afc2b

此外 BaseClass._request 出错后只是重新登录, 没有重试, 不知是算feature还是bug. 这种情况下baidu-fuse没有检查.

ly0 commented 8 years ago

重试确实是没有加的,应该放在上层程序里去判断

能否提交一个PR,我不大知道应该合并哪个分支。。。

gaohuazuo commented 8 years ago

没有提PR是因为 https://github.com/gaohuazuo/baidupcsapi/commit/eaac7a3d015548caa377565b37da273cf473f5dc 写得比较丑, 只能算是一个workaround.