From 6c33f35a24321f54d69822104e0a1431f75655db Mon Sep 17 00:00:00 2001 From: Matthew Welch Date: Thu, 2 Apr 2020 17:41:09 -0700 Subject: [PATCH] initial commit --- .gitignore | 1 + main.py | 14 ++++++++++++++ test.html | 13 +++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 .gitignore create mode 100644 main.py create mode 100644 test.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..112cc69 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +\.idea diff --git a/main.py b/main.py new file mode 100644 index 0000000..b1e4e7b --- /dev/null +++ b/main.py @@ -0,0 +1,14 @@ +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"])) diff --git a/test.html b/test.html new file mode 100644 index 0000000..241b67c --- /dev/null +++ b/test.html @@ -0,0 +1,13 @@ + + + + + Title + + +{{ version }} +{{ summary }} +{{ home_page }} +{{ sha256 }} + + \ No newline at end of file