def download(url, filename):
"""Download .su3 file, return True on success"""
USER_AGENT = "Wget/1.11.4"
url = "{}i2pseeds.su3".format(url)
req = urllib.request.Request(url, headers={"User-Agent": USER_AGENT})
try:
with urllib.request.urlopen(req) as resp:
with open(filename, 'wb') as f:
f.write(resp.read())
if os.stat(filename).st_size > 0:
return True
else:
return False
except URLError as e:
return False
评论列表
文章目录