diff options
author | asciimoo <asciimoo@gmail.com> | 2014-01-20 02:31:20 +0100 |
---|---|---|
committer | asciimoo <asciimoo@gmail.com> | 2014-01-20 02:31:20 +0100 |
commit | b2492c94f422e18cb8954ec983134f4fa5c7cdc0 (patch) | |
tree | 969ea30e5dc642d896fa7b744571110ebfe13e7a /searx/engines/mediawiki.py | |
parent | 692c0bf5f0b353bfbb46aaee1af54afb164dedbc (diff) | |
download | searxng-b2492c94f422e18cb8954ec983134f4fa5c7cdc0.tar.gz searxng-b2492c94f422e18cb8954ec983134f4fa5c7cdc0.zip |
[fix] pep/flake8 compatibility
Diffstat (limited to 'searx/engines/mediawiki.py')
-rw-r--r-- | searx/engines/mediawiki.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py index 00ad0f106..bc4aab6df 100644 --- a/searx/engines/mediawiki.py +++ b/searx/engines/mediawiki.py @@ -3,10 +3,12 @@ from urllib import urlencode, quote url = 'https://en.wikipedia.org/' +search_url = url + 'w/api.php?action=query&list=search&{query}&srprop=timestamp&format=json' # noqa + number_of_results = 10 + def request(query, params): - search_url = url + 'w/api.php?action=query&list=search&{query}&srprop=timestamp&format=json' params['url'] = search_url.format(query=urlencode({'srsearch': query})) return params @@ -14,7 +16,5 @@ def request(query, params): def response(resp): search_results = loads(resp.text) res = search_results.get('query', {}).get('search', []) - - return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')), + return [{'url': url + 'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8')), # noqa 'title': result['title']} for result in res[:int(number_of_results)]] - |