fail if init call fails
This commit is contained in:
parent
23bbdab7a1
commit
9da522a885
1 changed files with 6 additions and 3 deletions
|
@ -161,8 +161,8 @@ class Client(object):
|
||||||
def online(self):
|
def online(self):
|
||||||
self.api = API(self._config['url'], media_cache=self.media_cache())
|
self.api = API(self._config['url'], media_cache=self.media_cache())
|
||||||
self.api.DEBUG = DEBUG
|
self.api.DEBUG = DEBUG
|
||||||
self.signin()
|
if self.signin():
|
||||||
self.profile = "%sp.webm" % max(self.api.site['video']['resolutions'])
|
self.profile = "%sp.webm" % max(self.api.site['video']['resolutions'])
|
||||||
|
|
||||||
def signin(self):
|
def signin(self):
|
||||||
if 'username' in self._config:
|
if 'username' in self._config:
|
||||||
|
@ -172,10 +172,13 @@ class Client(object):
|
||||||
else:
|
else:
|
||||||
self.user = False
|
self.user = False
|
||||||
print '\nlogin failed! check config\n\n'
|
print '\nlogin failed! check config\n\n'
|
||||||
sys.exit()
|
sys.exit(1)
|
||||||
r = self.api.init()
|
r = self.api.init()
|
||||||
if r['status']['code'] == 200:
|
if r['status']['code'] == 200:
|
||||||
self.api.site = r['data']['site']
|
self.api.site = r['data']['site']
|
||||||
|
else:
|
||||||
|
print "\n init failed.", r['status']
|
||||||
|
sys.exit(1)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_encodes(self, site, files):
|
def set_encodes(self, site, files):
|
||||||
|
|
Loading…
Reference in a new issue