mirror of https://github.com/ivanch/tcc.git
17 lines
644 B
Python
17 lines
644 B
Python
import requests
|
|
|
|
def download_file(url):
|
|
local_filename = url.split('/')[-1]
|
|
with requests.get(url, stream=True) as r:
|
|
r.raise_for_status()
|
|
with open(local_filename, 'wb') as f:
|
|
for chunk in r.iter_content(chunk_size=8192):
|
|
# If you have chunk encoded response uncomment if
|
|
# and set chunk_size parameter to None.
|
|
#if chunk:
|
|
f.write(chunk)
|
|
return local_filename
|
|
|
|
def init():
|
|
download_file('https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png')
|
|
download_file('https://files.ivanch.me/api/public/dl/81Bkht5C/big-image.png') |