試圖在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及以上。 –