pypi_package_info/main.py
2020-04-02 17:41:09 -07:00

15 lines
447 B
Python

import requests
from jinja2 import Template
def package(package_name, template):
url = 'https://pypi.org/pypi/{}/json'.format(package_name)
info = dict(requests.get(url).json())
test_template = Template(open(template).read())
print(test_template.render(
version=info["info"]["version"],
summary=info["info"]["summary"],
home_page=info["info"]["home_page"],
sha256=info["releases"][info["info"]["version"]][0]["digests"]["sha256"]))