as i was writing this question i was playing around and figured out some answers ... hooray ! still have questions .
from https://github.com/rdio/rdio-simple/blob/master/python/rdio.py#L73 can i just save_token=rdio.token . then from http://www.rdio.com/developers/docs/libraries/simple/ it seems like i should totally be able to do this:
rdio = Rdio(("consumerkey", "consumersecret"), save_token)
and that works! sweet! but then i changed the token to see what the issues would be if i had the wrong token or some issue, no error got raised . and then when i tried:
(Pdb) !import code; code.interact(local=vars())
Python 2.7.9 (default, Feb 10 2015, 03:28:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> self.rdio.call("currentUser", '')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/timball/Documents/grimeys/rdio.py", line 88, in call
return json.loads(self.__signed_post('http://api.rdio.com/1/', params))
File "/Users/timball/Documents/grimeys/rdio.py", line 58, in __signed_post
res = urlopen(req)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 475, in error
return self._call_chain(*args)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
>>> self.rdio
<rdio.Rdio instance at 0x108b2bb90>
do i just have to wrap in a try, except wrapper and test for the 503 from the server ? or am i missing something ? probably missing something .
so in summary what does the Rdio() constructor return if the token is bad? or expired? or something else? shouldn't it raise an exception ? or want to raise an exception ? pretending to raise an exception . i guess i'm good w/ pretending , but it seems sad pants that i'll have to immediately make a call to hope for failure .
--timball