35def response(resp):
36 results = []
37
38 doc = html.fromstring(resp.text)
39
40 for result in eval_xpath_list(doc, results_xpath):
41 package_name = extract_text(eval_xpath(result, title_xpath))
42 results.append(
43 {
44 'template': 'packages.html',
45 'title': package_name,
46 'url': base_url + extract_text(eval_xpath(result, url_xpath)),
47 'content': extract_text(eval_xpath(result, content_xpath)),
48 'package_name': package_name,
49 'version': extract_text(eval_xpath(result, version_xpath)),
50 'popularity': extract_text(eval_xpath(result, download_count_xpath)),
51 'tags': eval_xpath_list(result, tags_xpath),
52 }
53 )
54
55 return results