Skip to content
Snippets Groups Projects
Unverified Commit 5646a9a4 authored by Kenneth Reitz's avatar Kenneth Reitz
Browse files

updated versions script


Signed-off-by: default avatarKenneth Reitz <me@kennethreitz.org>
parent 1caf2da0
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python #!/usr/bin/env python
print('2.7.13')
print('3.6.3') from vendor import requests
\ No newline at end of file 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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment