dont fail if no results are returned
This commit is contained in:
parent
d523862c9d
commit
6892909b3b
1 changed files with 5 additions and 4 deletions
|
@ -85,9 +85,10 @@ def find(query, max_results=10):
|
||||||
data = getUrl(url, timeout=0)
|
data = getUrl(url, timeout=0)
|
||||||
result = simplejson.loads(data)
|
result = simplejson.loads(data)
|
||||||
results = []
|
results = []
|
||||||
for r in result['query']['search']:
|
if result:
|
||||||
title = r['title']
|
for r in result['query']['search']:
|
||||||
url = "http://en.wikipedia.org/wiki/%s" % title.replace(' ', '_')
|
title = r['title']
|
||||||
results.append((title, url, ''))
|
url = "http://en.wikipedia.org/wiki/%s" % title.replace(' ', '_')
|
||||||
|
results.append((title, url, ''))
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue