should work with python3
This commit is contained in:
parent
2588144a58
commit
57f92d1e80
@ -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")
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user