我运行以下代码超过一年,它突然停止工作。它已经工作到2016年5月19日,它在2016年5月31日开始失败。
import soundcloud
client = soundcloud.Client(access_token=params['token'])
track_uri = client.get('/tracks/' + str(track_id)).uri # This works
client.put(track_uri, track=track) # This fails
它给了我以下追溯:
Traceback (most recent call last):
File "./tools/upload_track.py", line 56, in <module>
client.put(track_uri, track=track)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/soundcloud/client.py", line 133, in _request
return wrapped_resource(make_request(method, url, kwargs))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/soundcloud/request.py", line 148, in make_request
result.raise_for_status()
File "/Library/Python/2.7/site-packages/requests/models.py", line 844, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.soundcloud.com/tracks/266983865
事实证明,尽管出现了错误,我的曲目仍会上传到Soundcloud。不幸的是我无法忽略错误,因为在某些情况下我会发布新的曲目(client.post而不是client.put),我需要知道track_id,以便将它们放入播放列表。< / p>
我尝试过的一些事情,我得到了同样的错误: