forked from Icycoide/searxng
[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
|
@ -23,26 +23,30 @@ paging = True
|
|||
pagesize = 10
|
||||
|
||||
api_site = 'stackoverflow'
|
||||
api_sort= 'activity'
|
||||
api_sort = 'activity'
|
||||
api_order = 'desc'
|
||||
|
||||
# https://api.stackexchange.com/docs/advanced-search
|
||||
search_api = 'https://api.stackexchange.com/2.3/search/advanced?'
|
||||
|
||||
|
||||
def request(query, params):
|
||||
|
||||
args = urlencode({
|
||||
'q' : query,
|
||||
'page' : params['pageno'],
|
||||
'pagesize' : pagesize,
|
||||
'site' : api_site,
|
||||
'sort' : api_sort,
|
||||
'order': 'desc',
|
||||
})
|
||||
args = urlencode(
|
||||
{
|
||||
'q': query,
|
||||
'page': params['pageno'],
|
||||
'pagesize': pagesize,
|
||||
'site': api_site,
|
||||
'sort': api_sort,
|
||||
'order': 'desc',
|
||||
}
|
||||
)
|
||||
params['url'] = search_api + args
|
||||
|
||||
return params
|
||||
|
||||
|
||||
def response(resp):
|
||||
|
||||
results = []
|
||||
|
@ -56,10 +60,12 @@ def response(resp):
|
|||
content += ' // is answered'
|
||||
content += " // score: %s" % result['score']
|
||||
|
||||
results.append({
|
||||
'url': "https://%s.com/q/%s" % (api_site, result['question_id']),
|
||||
'title': html.unescape(result['title']),
|
||||
'content': html.unescape(content),
|
||||
})
|
||||
results.append(
|
||||
{
|
||||
'url': "https://%s.com/q/%s" % (api_site, result['question_id']),
|
||||
'title': html.unescape(result['title']),
|
||||
'content': html.unescape(content),
|
||||
}
|
||||
)
|
||||
|
||||
return results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue