Patching broken spotify token refresher
This commit is contained in:
@ -636,8 +636,9 @@ class IrisCore(object):
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(url, data)
|
||||
self.spotify_token = response.json()
|
||||
http_client = tornado.httpclient.AsyncHTTPClient()
|
||||
request = tornado.httpclient.HTTPRequest(url, method='POST', body=urllib.urlencode(data))
|
||||
http_client.fetch(request, callback=callback)
|
||||
|
||||
self.broadcast(
|
||||
data={
|
||||
@ -646,8 +647,6 @@ class IrisCore(object):
|
||||
}
|
||||
)
|
||||
|
||||
return self.get_spotify_token(callback=callback)
|
||||
|
||||
except urllib2.HTTPError as e:
|
||||
self.raven_client.captureException()
|
||||
error = json.loads(e.read())
|
||||
@ -724,7 +723,7 @@ class IrisCore(object):
|
||||
# Our request includes data, so make sure we POST the data
|
||||
if ('data' in data and data['data']):
|
||||
http_client = tornado.httpclient.AsyncHTTPClient()
|
||||
request = tornado.httpclient.HTTPRequest(data['url'], method='POST', data=data['data'], headers=headers, validate_cert=False)
|
||||
request = tornado.httpclient.HTTPRequest(data['url'], method='POST', body=json.dumps(data['data']), headers=headers, validate_cert=False)
|
||||
http_client.fetch(request, callback=callback)
|
||||
|
||||
# No data, so just a simple GET request
|
||||
|
||||
@ -201,6 +201,7 @@ class HttpHandler(tornado.web.RequestHandler):
|
||||
# when our request calls subsequent external requests (eg Spotify, Genius).
|
||||
# We don't need to wrap non-HTTPResponse responses as these are dicts
|
||||
if isinstance(response, tornado.httpclient.HTTPResponse):
|
||||
print response.body
|
||||
response = {
|
||||
'response_code': response.code,
|
||||
'response_reason': response.reason,
|
||||
|
||||
Reference in New Issue
Block a user