From 9da522a8859cd5b330693e1b2420d63bfa554143 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 6 Mar 2012 21:32:52 +0100 Subject: [PATCH] fail if init call fails --- pandora_client/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 16c8b75..79f7144 100644 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -161,8 +161,8 @@ class Client(object): def online(self): self.api = API(self._config['url'], media_cache=self.media_cache()) self.api.DEBUG = DEBUG - self.signin() - self.profile = "%sp.webm" % max(self.api.site['video']['resolutions']) + if self.signin(): + self.profile = "%sp.webm" % max(self.api.site['video']['resolutions']) def signin(self): if 'username' in self._config: @@ -172,10 +172,13 @@ class Client(object): else: self.user = False print '\nlogin failed! check config\n\n' - sys.exit() + sys.exit(1) r = self.api.init() if r['status']['code'] == 200: self.api.site = r['data']['site'] + else: + print "\n init failed.", r['status'] + sys.exit(1) return True def set_encodes(self, site, files):