From 5646a9a483a755fd274fc0efe2173971e3cd2aa5 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz <me@kennethreitz.org>
Date: Wed, 29 Nov 2017 08:43:54 -0600
Subject: [PATCH] updated versions script

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
---
 versions/python | 35 +++++++++++++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/versions/python b/versions/python
index 0aab24ec..319c1839 100755
--- a/versions/python
+++ b/versions/python
@@ -1,3 +1,34 @@
 #!/usr/bin/env python
-print('2.7.13')
-print('3.6.3')
\ No newline at end of file
+
+from vendor import requests
+from vendor import parse
+
+# The Source of Truth.
+SOURCE_URI = 'https://www.python.org/downloads/'
+
+# The Parse template for finding the truth amongst the HTML.
+PARSE_VERSION_TEMPLATE = '<a href="/downloads/release/python-{}/">Python {}</a>'
+
+
+def yield_versions():
+    """Discovers currently–released Python versions from Python.org.from
+    Yields them as an iterator."""
+
+    # Make the HTTP request.
+    r = requests.get('https://www.python.org/downloads/')
+
+    #
+    for result in parse.findall(PARSE_VERSION_TEMPLATE, r.text):
+        # Print each version release number.
+        yield result[1]
+
+
+def main():
+    """Print each version number to stdout."""
+    for version in yield_versions():
+        print(version)
+
+
+# If executed directly, run main automatically.
+if __name__ == '__main__':
+    main()
-- 
GitLab