2012-06-01, 23:58
So I've been playing with the Json api to get the pandora addon to work. But I've hit a problem I can't seem to understand.
First, here's the part of debug log:
Here is the JsonGetURL method:
The confusing part for me is, if I call the method directly (manually) using the postdata and url, it works. But when it is called from pandagui, it results in the error posted above. If anyone can explain to me what is happening, what I'm doing wrong, that would really help. Thanks.
First, here's the part of debug log:
Code:
NOTICE: JsonGetURL:
16:34:34 T:5928 NOTICE: Url: http://tuner.pandora.com/services/json/?method=user.getStationList&auth_token=VI%2F6qydeGak8ipm%2Bvr4F%2BZogv27V%2Fd2a649kIEOde8atw%3D&partner_id=42&user_id=REDACTED
16:34:34 T:5928 NOTICE: postData: 0b5b3f806abef32879a802a0749e65e921273e594f5d63b3baca343ea9357bc32fcf397efe26cecbaadc92a2cf3da058404d0a13a1878461a9de5d00512b44dc491108c6b8cfdf2f0fd570086c48a42028891021591af88d5f58b7bd7541aaea
16:34:34 T:5928 NOTICE: After Request
16:34:34 T:5928 NOTICE: Error at JsonGetURL: WTF?
16:34:34 T:5928 ERROR: Exception in python script callback execution
16:34:34 T:5928 ERROR: Traceback (most recent call last):
16:34:34 T:5928 ERROR: File "C:\Documents and Settings\XXXXX\Application Data\XBMC\addons\script.xbmc.pandorajson\pandagui.py", line 39, in onInit
16:34:34 T:5928 ERROR: self.getControl(BTN_THUMBED_DN).setVisible(False)
16:34:34 T:5928 ERROR: TypeError
16:34:34 T:5928 ERROR: :
16:34:34 T:5928 ERROR: Non-Existent Control 337
Here is the JsonGetURL method:
Code:
def JsonGetURL(Url, postData=None):
print 'JsonGetURL:'
print 'Url: ' + Url
print 'postData: ' + postData
try:
req = urllib2.Request(Url, postData, {'Content-Type': 'application/json'})
print 'After Request'
u = urllib2.urlopen(req)
print 'After urlopen:'
resp = u.read()
u.close()
return resp
print 'After return?'
except:
print 'Error at JsonGetURL: WTF?'
return None
The confusing part for me is, if I call the method directly (manually) using the postdata and url, it works. But when it is called from pandagui, it results in the error posted above. If anyone can explain to me what is happening, what I'm doing wrong, that would really help. Thanks.