A new user interface for you! Read more...

File fetchLatest.py of Package consul

#!/usr/bin/env python3

import urllib.request
import requests
from bs4 import BeautifulSoup
from natsort import natsorted
import re
import zipfile
from io import BytesIO

## Set Consul Download Directory
consul_download_dir = "https://releases.hashicorp.com/consul/"

## Set Consul Dir
consul_available_versions = requests.get(consul_download_dir)

## Get Link Text
consul_download_dir_text = BeautifulSoup(consul_available_versions.content, "html.parser")
consul_download_names = consul_download_dir_text.find_all('a')

## Build List
consul_versions = []
for i in consul_download_names:
    if re.search("^consul_[0-9.]*$", i.string):
        consul_versions.append(i.string)
consul_versions = natsorted(consul_versions)

consul_latest_version = consul_versions[-1].split('_')[1]
print("Latest Consul Version:", consul_latest_version)

## Download i386
consul_download_i386 = requests.get("https://releases.hashicorp.com/consul/" + consul_latest_version + "/consul_" + consul_latest_version + "_linux_386.zip")
zipfile.ZipFile(BytesIO(consul_download_i386.content)).extractall("i386")

## Download amd64
consul_download_amd64 = requests.get("https://releases.hashicorp.com/consul/" + consul_latest_version + "/consul_" + consul_latest_version + "_linux_amd64.zip")
zipfile.ZipFile(BytesIO(consul_download_amd64.content)).extractall("amd64")

## Set Version
file = open("version","w+") 
file.truncate()
file.write(consul_latest_version) 
file.close()