houtianze/bypy

使用自己的appid出错

Closed this issue · 2 comments

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

sys.stdout.encoding = UTF-8

[12:58:00] Error while loading baidu pcs token:
[12:58:00] Traceback (most recent call last):
File "bypy.py", line 908, in __load_local_json
with open(TokenFilePath, 'rb') as infile:
IOError: [Errno 2] No such file or directory: u'/root/.bypy.json'

GET https://openapi.baidu.com/oauth/2.0/device/code
actargs: None
Params: {u'scope': u'basic netdisk', u'response_type': u'device_code', u'client_id': u'xxx'}
HTTP Status Code: 200
Request OK, processing action
Please visit:
https://openapi.baidu.com/device within 1800 seconds
Input the CODE: zt6u37jq
and Authorize this little app.
Press [Enter] when you've finished
GET https://openapi.baidu.com/oauth/2.0token
actargs: None
Params: {u'code': u'40dc1674e79fa253706a6ed834d573db', u'client_secret': u'xxxxxxxx', u'grant_type': u'device_token', u'client_id': u'xxxxxx'}
HTTP Status Code: 200
Request OK, processing action
[12:58:20] Error accessing 'https://openapi.baidu.com/oauth/2.0token'
[12:58:20] Exception: No JSON object could be decoded
Traceback (most recent call last):
File "bypy.py", line 817, in **request_work
result = act(r, actargs)
File "bypy.py", line 974, in __get_token_act
return self.__store_json(r)
File "bypy.py", line 935, in __store_json
return self.__store_json_only(r.json())
File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 741, in json
return json.loads(self.text, kwargs)
File "/usr/lib/python2.7/json/__init
.py", line 326, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 383, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

[12:58:20] Function: **get_token_act
[12:58:20] Website parameters: {u'code': u'40dc1674e79fa253706a6ed834d573db', u'client_secret': u'xxxxxx', u'grant_type': u'device_token', u'client_id': u'xxxxxxx'}
[12:58:20] HTTP Status Code: 200
[12:58:20] Error parsing JSON Error Code from
[12:58:20] Exception: Traceback (most recent call last):
File "bypy.py", line 759, in __print_error_json
dj = r.json()
File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 741, in json
return json.loads(self.text, kwargs)
File "/usr/lib/python2.7/json/__init
.py", line 326, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 383, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

我明天看一下,谢谢反馈。

@heimi 发现问题了,token地址少了一个'/',测试一下,本地授权应该没问题了。