Pillow/winbuild/fetch.py
2014-03-18 20:59:42 -07:00

8 lines
285 B
Python

import sys, os, urllib.parse, urllib.request
name = urllib.parse.urlsplit(sys.argv[1])[2].split('/')[-1]
if not os.path.exists(name):
print("Fetching", sys.argv[1])
content = urllib.request.urlopen(sys.argv[1]).read()
with open(name, 'wb') as fd:
fd.write(content)