12345678910111213141516171819202122232425
  1. categories = ['general'] # optional
  2. def request(query, params):
  3. '''pre-request callback
  4. params<dict>:
  5. method : POST/GET
  6. headers : {}
  7. data : {} # if method == POST
  8. url : ''
  9. category: 'search category'
  10. pageno : 1 # number of the requested page
  11. '''
  12. params['url'] = 'https://host/%s' % query
  13. return params
  14. def response(resp):
  15. '''post-response callback
  16. resp: requests response object
  17. '''
  18. return [{'url': '', 'title': '', 'content': ''}]