From 706b5e218b15c9dcbc9a26339c5b8911ea200315 Mon Sep 17 00:00:00 2001 From: Nemo Date: Mon, 17 Oct 2022 14:15:16 +0530 Subject: [PATCH] [pypi] Very old releases don't have data on the API See https://pypi.org/pypi/numpy/json --- .editorconfig | 3 +++ src/pypi.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 19fa9dfa..be51087f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,3 +11,6 @@ trim_trailing_whitespace = true indent_style = space indent_size = 2 insert_final_newline = true + +[*.py] +indent_size = 4 diff --git a/src/pypi.py b/src/pypi.py index 4543d3db..4b606a7b 100644 --- a/src/pypi.py +++ b/src/pypi.py @@ -32,7 +32,7 @@ def fetch_releases(pypi_id, regex): for r in regex: if re.match(r, version): matches = True - if matches: + if matches and R: d = datetime.fromisoformat(R[0]["upload_time"]).strftime("%Y-%m-%d") releases[version] = d print("%s: %s" % (version, d))