imochoa / dotfiles

collection of the setting that I like as well as some scripts to automate the post-install setup process
MIT License
0 stars 0 forks source link

get latest release unless specified #61

Open imochoa opened 4 years ago

imochoa commented 4 years ago
import urllib.request
import urllib.parse

def get_latest_release_url(user_and_repo):

    url = f"https://github.com/{urllib.parse.quote(user_and_repo)}/releases/latest"

    with urllib.request.urlopen(url) as fp:
        # html = fp.read().decode('utf8')
        return fp.url

print(get_latest_release_url('pdfminer/pdfminer.six'))