38 '''post-response callback
39 resp: requests response object
42 json_resp = resp.json()
44 for item
in json_resp.get(
"results", []):
45 image_source = item.get(
"source")
46 is_official = image_source
in [
"store",
"official"]
48 popularity_infos = [f
"{item.get('star_count', 0)} stars"]
51 for rate_plan
in item.get(
"rate_plans", []):
52 pull_count = rate_plan.get(
"repositories", [{}])[0].get(
"pull_count")
54 popularity_infos.insert(0, f
"{pull_count} pulls")
55 architectures.extend(arch[
'name']
for arch
in rate_plan.get(
"architectures", [])
if arch[
'name'])
58 'template':
'packages.html',
59 'url': base_url + (
"/_/" if is_official
else "/r/") + item.get(
"slug",
""),
60 'title': item.get(
"name"),
61 'content': item.get(
"short_description"),
62 'thumbnail': item[
"logo_url"].get(
"large")
or item[
"logo_url"].get(
"small"),
63 'package_name': item.get(
"name"),
64 'maintainer': item[
"publisher"].get(
"name"),
65 'publishedDate': parser.parse(item.get(
"updated_at")
or item.get(
"created_at")),
66 'popularity':
', '.join(popularity_infos),
67 'tags': architectures,
69 results.append(result)