comparison sat_frontends/jp/base.py @ 2672:0bed6df9ee5d

jp: fixed bad call to quit
author Goffi <goffi@goffi.org>
date Fri, 14 Sep 2018 16:44:34 +0200
parents 0fa217fafabf
children 7d4679ee7ded
comparison
equal deleted inserted replaced
2671:0fa217fafabf 2672:0bed6df9ee5d
465 # HTTP URL, we try to find xmpp: links 465 # HTTP URL, we try to find xmpp: links
466 try: 466 try:
467 from lxml import etree 467 from lxml import etree
468 except ImportError: 468 except ImportError:
469 self.disp(u"lxml module must be installed to use http(s) scheme, please install it with \"pip install lxml\"", error=True) 469 self.disp(u"lxml module must be installed to use http(s) scheme, please install it with \"pip install lxml\"", error=True)
470 self.host.quit(1) 470 self.quit(1)
471 import urllib2 471 import urllib2
472 parser = etree.HTMLParser() 472 parser = etree.HTMLParser()
473 try: 473 try:
474 root = etree.parse(urllib2.urlopen(http_url), parser) 474 root = etree.parse(urllib2.urlopen(http_url), parser)
475 except etree.XMLSyntaxError as e: 475 except etree.XMLSyntaxError as e:
477 links = [] 477 links = []
478 else: 478 else:
479 links = root.xpath("//link[@rel='alternate' and starts-with(@href, 'xmpp:')]") 479 links = root.xpath("//link[@rel='alternate' and starts-with(@href, 'xmpp:')]")
480 if not links: 480 if not links:
481 self.disp(u'Could not find alternate "xmpp:" URI, can\'t find associated XMPP PubSub node/item', error=True) 481 self.disp(u'Could not find alternate "xmpp:" URI, can\'t find associated XMPP PubSub node/item', error=True)
482 self.host.quit(1) 482 self.quit(1)
483 xmpp_uri = links[0].get('href') 483 xmpp_uri = links[0].get('href')
484 return xmpp_uri 484 return xmpp_uri
485 485
486 def parse_pubsub_args(self): 486 def parse_pubsub_args(self):
487 if self.args.pubsub_url is not None: 487 if self.args.pubsub_url is not None: