问题
import soundcloud
client = soundcloud.Client(client_id='mykey')
page_size = 10
tracks = client.get('/tracks', q='lorde',limit=page_size)
users = client.get('/users', q='lorde',limit=page_size)
sets = client.get('/playlists',q='lorde',limit=page_size)
In the above extract of Python code, whilst tracks and users works perfectly fine, the last line returns the following error.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "soundcloud/client.py", line 130, in _request
return wrapped_resource(make_request(method, url, kwargs))
File "soundcloud/request.py", line 134, in make_request
result.raise_for_status()
File "/Library/Python/2.7/site-packages/requests/models.py", line 829, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 502 Server Error: Bad Gateway
For phrases which return less results, such as 'banana phone', the query works perfectly fine (albeit slightly slowly). However for the search above which returns more results, an error is returned. This search also works on the website, so my assumption is that this is linked to the fact I'm using soundcloud-python. What am I doing wrong and how I can I resolve this error?
来源:https://stackoverflow.com/questions/31078410/502-error-when-searching-on-soundcloud-playlists