54 doc = html.fromstring(resp.text)
56 for result
in eval_xpath_list(doc, results_xpath):
57 publishedDate = extract_text(eval_xpath(result, updated_xpath))
59 publishedDate = parser.parse(publishedDate)
60 except parser.ParserError:
64 popularity = extract_text(eval_xpath(result, popularity_xpath)).strip()
65 popularity = babel.numbers.parse_decimal(popularity, locale=
'en_US')
67 popularity = flask_babel.format_decimal(popularity)
71 'template':
'packages.html',
72 'url': base_url + extract_text(eval_xpath(result, url_xpath)),
73 'title': extract_text(eval_xpath(result, title_xpath)),
74 'content': extract_text(eval_xpath(result, content_xpath)),
75 'package_name': re.sub(
r"\(|\)",
"", extract_text(eval_xpath(result, package_name_xpath))),
76 'version': extract_text(eval_xpath(result, version_xpath)),
77 'popularity': popularity,
78 'license_name': extract_text(eval_xpath(result, license_name_xpath)),
79 'license_url': base_url + extract_text(eval_xpath(result, license_url_xpath)),
80 'publishedDate': publishedDate,