diff options
author | Adam Tauber <asciimoo@gmail.com> | 2014-09-04 23:53:13 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2014-09-04 23:53:13 +0200 |
commit | 35ddbecd744c51da3b0c5d40f8462925841473a4 (patch) | |
tree | 6bf5a812aa359daa5716a63ff2a4a5230ca48ef5 /searx/engines/mediawiki.py | |
parent | 29afa9b4a1c1d79673f5e1b8bc0dda58fe737cff (diff) | |
download | searxng-35ddbecd744c51da3b0c5d40f8462925841473a4.tar.gz searxng-35ddbecd744c51da3b0c5d40f8462925841473a4.zip |
[fix] string formatting
Diffstat (limited to 'searx/engines/mediawiki.py')
-rw-r--r-- | searx/engines/mediawiki.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py index ab1d1b90f..ea3feb157 100644 --- a/searx/engines/mediawiki.py +++ b/searx/engines/mediawiki.py @@ -22,13 +22,13 @@ number_of_results = 1 # search-url base_url = 'https://{language}.wikipedia.org/' -search_url = base_url + 'w/api.php?action=query\ - &list=search\ - &{query}\ - &srprop=timestamp\ - &format=json\ - &sroffset={offset}\ - &srlimit={limit}' +search_url = base_url + 'w/api.php?action=query'\ + '&list=search'\ + '&{query}'\ + '&srprop=timestamp'\ + '&format=json'\ + '&sroffset={offset}'\ + '&srlimit={limit}' # do search-request @@ -37,7 +37,7 @@ def request(query, params): string_args = dict(query=urlencode({'srsearch': query}), offset=offset, limit=number_of_results) - format_strings = Formatter().parse(base_url) + format_strings = list(Formatter().parse(base_url)) if params['language'] == 'all': language = 'en' @@ -46,6 +46,7 @@ def request(query, params): if len(format_strings) > 1: string_args['language'] = language + print search_url.format(**string_args) # write search-language back to params, required in response params['language'] = language |