34def response(resp):
35 '''post-response callback
36 resp: requests response object
37 '''
38 results = []
39 body = resp.json()
40
41 for item in body.get("summaries", []):
42 filter_type = item.get("filter_type")
43 is_official = filter_type in ["store", "official"]
44
45 result = {
46 'template': 'packages.html',
47 'url': base_url + ("_/" if is_official else "r/") + item.get("slug", ""),
48 'title': item.get("name"),
49 'content': item.get("short_description"),
50 'thumbnail': item["logo_url"].get("large") or item["logo_url"].get("small"),
51 'package_name': item.get("name"),
52 'maintainer': item["publisher"].get("name"),
53 'publishedDate': parser.parse(item.get("updated_at") or item.get("created_at")),
54 'popularity': item.get("pull_count", "0") + " pulls",
55 'tags': [arch['name'] for arch in item["architectures"]],
56 }
57 results.append(result)
58
59 return results