2020-08-14 10:25:48 +00:00
|
|
|
# MIT licensed
|
|
|
|
# Copyright (c) 2017-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
|
|
|
|
2023-10-18 00:00:46 +00:00
|
|
|
from nvchecker.api import RichResult
|
|
|
|
|
2020-08-14 10:25:48 +00:00
|
|
|
URL = 'https://release-monitoring.org/api/project/{pkg}'
|
|
|
|
|
|
|
|
async def get_version(name, conf, *, cache, **kwargs):
|
2024-08-08 15:13:47 +00:00
|
|
|
pkg = conf.get('anitya_id')
|
|
|
|
if pkg is None:
|
|
|
|
pkg = conf.get('anitya')
|
2020-08-14 10:25:48 +00:00
|
|
|
url = URL.format(pkg = pkg)
|
|
|
|
data = await cache.get_json(url)
|
2023-10-18 00:00:46 +00:00
|
|
|
return RichResult(
|
|
|
|
version = data['version'],
|
|
|
|
url = f'https://release-monitoring.org/project/{data["id"]}/',
|
|
|
|
)
|