should work with python3

This commit is contained in:
spike 2022-10-12 13:51:18 +02:00
parent 2588144a58
commit 57f92d1e80

View File

@ -18,7 +18,7 @@ class SOSearch(Site):
super(SOSearch, self).__init__(self.domain, **kw) super(SOSearch, self).__init__(self.domain, **kw)
self.qs = self.search(order=DESC, sort='votes', tagged=self.tags, self.qs = self.search(order=DESC, sort='votes', tagged=self.tags,
intitle=self.qs, filter='!-u2CTCMX') intitle=self.qs, filter='!-u2CTCMX')
if self.qs.total == 0: if len(self.qs) == 0:
raise NoResult raise NoResult
def first_q(self): def first_q(self):
@ -68,10 +68,10 @@ def main(args):
so = SOSearch(args.query, args.tags) so = SOSearch(args.query, args.tags)
result = so.first_q().best_answer.code result = so.first_q().best_answer.code
if result != None: if result != None:
print result print(result)
else: else:
print("Sorry I can't find your answer, try adding tags") print("Sorry I can't find your answer, try adding tags")
except NoResult, e: except NoResult:
print("Sorry I can't find your answer, try adding tags") print("Sorry I can't find your answer, try adding tags")