mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-13 21:26:46 +03:00
17 lines
370 B
Python
17 lines
370 B
Python
import sys, os, urllib.parse, urllib.request
|
|
|
|
def fetch(url):
|
|
name = urllib.parse.urlsplit(url)[2].split('/')[-1]
|
|
|
|
if not os.path.exists(name):
|
|
print("Fetching", url)
|
|
content = urllib.request.urlopen(url).read()
|
|
with open(name, 'wb') as fd:
|
|
fd.write(content)
|
|
return name
|
|
|
|
if __name__=='__main__':
|
|
fetch(sys.argv[1])
|
|
|
|
|