spotify-local-http-api
spotify-local-http-api copied to clipboard
Broken?
Can't seem to complete an SSL handshake with Ubuntu Linux.
Traceback (most recent call last):
File "http_remote.py", line 90, in <module>
oauth_token = get_oauth_token()
File "http_remote.py", line 44, in get_oauth_token
return get_json('http://open.spotify.com/token')['t']
File "http_remote.py", line 26, in get_json
return json.loads(urllib2.urlopen(request).read())
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 442, in error
result = self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 629, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 1] _ssl.c:510: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure>
Could it have something to do with incompatible libs? I can control the desktop player via HTTP through the browser just fine.
Also, the default port seems to have changed to 4371
.
Does your code work with the latest Spotify player on your machine?
+1 for this, spotify has killed sslv3, can you update it to work with tls?
Ok, sounds reasonable they did that given SSLv3 is broken.
I really don't use this, its been more of a PoC. But I'm guessing you need to make urllib2 use TLS instead of SSL to make it work again.
Changing kwargs['ssl_version'] = ssl.PROTOCOL_SSLv3
to kwargs['ssl_version'] = ssl.PROTOCOL_TLSv1
works for the oauth token but the next error ist:
urllib2.URLError: <urlopen error [Errno 1] _ssl.c:510: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number>
Yes, I tried that, and also got the same error, no idea how to fix it though ;(
If you don't need exact this script, this fork is working: https://github.com/thiderman/spoticli
I fixed the backend of many of the scripts, you can find a working example here
I detailed the changes here
I fixed it here https://github.com/nih0/spotify-local-http-api