试图在Python“未经的SoundCloud连接屏幕身份验证”来验证测试的注册的应用程序,按照: http://developers.soundcloud.com/docs/api/guide#user-credentials的SoundCloud API返回服务器端的Python认证401错误
import soundcloud
# create client object with app and user credentials
client = soundcloud.Client(client_id='YOUR_CLIENT_ID',
client_secret='YOUR_CLIENT_SECRET',
username='YOUR_USERNAME',
password='YOUR_PASSWORD')
的password='YOUR_PASSWORD'
线抛出错误:
File "/usr/local/lib/python2.7/dist-packages/soundcloud/client.py", line 41, in __init__
self._credentials_flow()
File "/usr/local/lib/python2.7/dist-packages/soundcloud/client.py", line 112, in _credentials_flow
make_request('post', url, options))
File "/usr/local/lib/python2.7/dist-packages/soundcloud/resource.py", line 62, in wrapped_resource
setattr(result, attr, getattr(response, attr))
AttributeError: 'Response' object has no attribute 'error'
如果我在try:
包装它,我得到:
Error: 401 Client Error: None, Status Code: 401
我已经三重检查了client_id和client_secret,我可以在网站上使用相同的凭据登录,并且我已经在代码中尝试了“用户名”和“[email protected]”格式。有任何想法吗?
[编辑:]记录,'用户名'和'[email protected]'格式的工作。
尝试将'requests'降级到版本0.14.2。我怀疑'soundcloud'如果b0rken for'requests'版本1.0.0及以上。 –