mirror of
https://github.com/searxng/searxng.git
synced 2025-08-02 01:52:21 +02:00
[format.python] initial formatting of the python code
This patch was generated by black [1]:: make format.python [1] https://github.com/psf/black Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
fcdc2c2cd2
commit
3d96a9839a
184 changed files with 2800 additions and 2836 deletions
|
@ -55,12 +55,12 @@ def fetch_extra_param(query_args, headers):
|
|||
extra_param_path = search_path + urlencode(query_args)
|
||||
text = get(base_url + extra_param_path, headers=headers).text
|
||||
|
||||
re_var= None
|
||||
re_var = None
|
||||
for line in text.splitlines():
|
||||
if re_var is None and extra_param_path in line:
|
||||
var = line.split("=")[0].split()[1] # e.g. var --> 'uxrl'
|
||||
re_var = re.compile(var + "\\s*=\\s*" + var + "\\s*\\+\\s*'" + "(.*)" + "'(.*)")
|
||||
extra_param = line.split("'")[1][len(extra_param_path):]
|
||||
extra_param = line.split("'")[1][len(extra_param_path) :]
|
||||
continue
|
||||
if re_var is not None and re_var.search(line):
|
||||
extra_param += re_var.search(line).group(1)
|
||||
|
@ -69,12 +69,7 @@ def fetch_extra_param(query_args, headers):
|
|||
|
||||
# do search-request
|
||||
def request(query, params): # pylint: disable=unused-argument
|
||||
query_args = dict(
|
||||
c = 'main'
|
||||
, q = query
|
||||
, dr = 1
|
||||
, showgoodimages = 0
|
||||
)
|
||||
query_args = dict(c='main', q=query, dr=1, showgoodimages=0)
|
||||
|
||||
if params['language'] and params['language'] != 'all':
|
||||
query_args['qlangcountry'] = params['language']
|
||||
|
@ -93,6 +88,7 @@ def request(query, params): # pylint: disable=unused-argument
|
|||
|
||||
return params
|
||||
|
||||
|
||||
# get response from search-request
|
||||
def response(resp):
|
||||
results = []
|
||||
|
@ -125,10 +121,6 @@ def response(resp):
|
|||
if len(subtitle) > 3 and subtitle != title:
|
||||
title += " - " + subtitle
|
||||
|
||||
results.append(dict(
|
||||
url = url
|
||||
, title = title
|
||||
, content = content
|
||||
))
|
||||
results.append(dict(url=url, title=title, content=content))
|
||||
|
||||
return results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue