Utility to get last redash release url

This commit is contained in:
Arik Fraimovich 2014-04-13 16:35:45 +03:00
parent 1a8611a3c0
commit 31cc6fdaeb

25
bin/latest_release.py Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env python
import sys
import requests
if __name__ == '__main__':
response = requests.get('https://api.github.com/repos/EverythingMe/redash/releases')
if response.status_code != 200:
exit("Failed getting releases (status code: %s)." % response.status_code)
sorted_releases = sorted(response.json(), key=lambda release: release['id'], reverse=True)
latest_release = sorted_releases[0]
asset_url = latest_release['assets'][0]['url']
if '--url-only' in sys.argv:
print asset_url
else:
print "Latest release: %s" % latest_release['tag_name']
print latest_release['body']
print "\nTarball URL: %s" % asset_url
print 'wget: wget --header="Accept: application/octet-stream" %s' % asset_url