58def response(resp):
59 results = []
60 for package in resp.json():
61 meta = package["meta"]
62 published_date = package.get("updated_at")
63 published_date = parser.parse(published_date)
64 links = {linked_terms.get(k.lower(), k): v for k, v in meta.get("links").items()}
65 results.append(
66 {
67 "template": "packages.html",
68 "url": package["html_url"],
69 "title": package["name"],
70 "package_name": package["name"],
71 "content": meta.get("description", ""),
72 "version": meta.get("latest_version"),
73 "maintainer": ", ".join(meta.get("maintainers", [])),
74 "publishedDate": published_date,
75 "license_name": ", ".join(meta.get("licenses", [])),
76 "homepage": package["docs_html_url"],
77 "links": links,
78 }
79 )
80
81 return results