mirror of
https://github.com/lilydjwg/nvchecker
synced 2024-12-13 10:15:21 +00:00
11 lines
355 B
Python
11 lines
355 B
Python
# MIT licensed
|
|
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
|
|
|
|
API_URL = 'https://crates.io/api/v1/crates/%s'
|
|
|
|
async def get_version(name, conf, *, cache, **kwargs):
|
|
name = conf.get('cratesio') or name
|
|
data = await cache.get_json(API_URL % name)
|
|
version = [v['num'] for v in data['versions'] if not v['yanked']][0]
|
|
return version
|