57def response(resp):
58 results = []
59
60 doc = html.fromstring(resp.text)
61 for result in eval_xpath_list(doc, "//table/tbody/tr"):
62
63 if len(result.xpath("./td")) < 9:
64
65
66 continue
67
68 results.append(
69 {
70 'template': 'packages.html',
71 'url': base_url + extract_text(eval_xpath(result, './td[contains(@class, "package")]/a/@href')),
72 'title': extract_text(eval_xpath(result, './td[contains(@class, "package")]')),
73 'package_name': extract_text(eval_xpath(result, './td[contains(@class, "package")]')),
74 'publishedDate': parser.parse(extract_text(eval_xpath(result, './td[contains(@class, "bdate")]'))),
75 'version': extract_text(eval_xpath(result, './td[contains(@class, "version")]')),
76 'homepage': extract_text(eval_xpath(result, './td[contains(@class, "url")]/a/@href')),
77 'maintainer': extract_text(eval_xpath(result, './td[contains(@class, "maintainer")]')),
78 'license_name': extract_text(eval_xpath(result, './td[contains(@class, "license")]')),
79 'tags': [extract_text(eval_xpath(result, './td[contains(@class, "repo")]'))],
80 }
81 )
82
83 return results