Commit 8dfc2721 authored by András Veres-Szentkirályi's avatar András Veres-Szentkirályi
Browse files

[enh] simplified mediawiki response processing

parent 47a23898
......@@ -13,11 +13,6 @@ def request(query, params):
def response(resp):
search_results = loads(resp.text)
results = []
res = search_results.get('query', {}).get('search', [])
if not len(res):
return results
for result in res[:int(number_of_results)]:
results.append({'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')), 'title': result['title']})
return results
return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')),
'title': result['title']} for result in res[:int(number_of_results)]]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment