Files
linux-kernel-module-cheat/download-latest-release
Ciro Santilli 六四事件 法轮功 72d18a72b2 readme: make prebuilt work brutally
2018-09-16 08:17:18 +01:00

17 lines
587 B
Python
Executable File

#!/usr/bin/env python3
'''
Download the latest release from GitHub:
https://stackoverflow.com/questions/24987542/is-there-a-link-to-github-for-downloading-a-file-in-the-latest-release-of-a-repo/50540591#50540591
'''
import json
import urllib.request
_json = json.loads(urllib.request.urlopen(urllib.request.Request(
'https://api.github.com/repos/cirosantilli/linux-kernel-module-cheat/releases',
headers={'Accept' : 'application/vnd.github.full+json"text/html'}
)).read())
asset = _json[0]['assets'][0]
urllib.request.urlretrieve(asset['browser_download_url'], asset['name'])