File: launchpad.py

package info (click to toggle)
python-nvchecker 2.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 736 kB
  • sloc: python: 4,801; makefile: 25
file content (20 lines) | stat: -rw-r--r-- 621 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# MIT Licensed
# Copyright (c) 2024 Bert Peters <bertptrs@archlinux.org>, et al.
from __future__ import annotations
from nvchecker.api import AsyncCache, Entry, RichResult

PROJECT_INFO_URL = "https://api.launchpad.net/1.0/{launchpad}"

async def get_version(name: str, conf: Entry, *, cache: AsyncCache, **kwargs):
  launchpad = conf["launchpad"]

  project_data = await cache.get_json(PROJECT_INFO_URL.format(launchpad=launchpad))
  data = await cache.get_json(project_data['releases_collection_link'])

  return [
    RichResult(version=entry["version"], url=entry["web_link"])
    for entry in data["entries"]
  ]