File: basic_engine.py

package info (click to toggle)
searx 1.1.0%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 9,644 kB
  • sloc: python: 16,545; sh: 3,842; javascript: 2,104; xml: 1,071; makefile: 118
file content (25 lines) | stat: -rw-r--r-- 521 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

categories = ['general']  # optional


def request(query, params):
    '''pre-request callback
    params<dict>:
      method  : POST/GET
      headers : {}
      data    : {} # if method == POST
      url     : ''
      category: 'search category'
      pageno  : 1 # number of the requested page
    '''

    params['url'] = 'https://host/%s' % query

    return params


def response(resp):
    '''post-response callback
    resp: requests response object
    '''
    return [{'url': '', 'title': '', 'content': ''}]