42def response(resp):
43 results = []
44
45 for package in resp.json()["crates"]:
46
47 published_date = package.get("updated_at")
48 published_date = parser.parse(published_date)
49
50 links = {}
51 for k, v in linked_terms.items():
52 l = package.get(k)
53 if l:
54 links[v] = l
55
56 results.append(
57 {
58 "template": "packages.html",
59 "url": f'https://crates.io/crates/{package["name"]}',
60 "title": package["name"],
61 "package_name": package["name"],
62 "tags": package["keywords"],
63 "content": package["description"],
64 "version": package["newest_version"] or package["max_version"] or package["max_stable_version"],
65 "publishedDate": published_date,
66 "links": links,
67 }
68 )
69
70 return results