7 lines
275 B
Python
7 lines
275 B
Python
|
def download(url):
|
||
|
try:
|
||
|
html = urllib.request.urlopen(urllib.request.Request(url,headers={'User-Agent': 'Mozilla'})).read()
|
||
|
except (URLError, HTTPError, ContentTooShortError) as e:
|
||
|
print('Download error:', e.reason)
|
||
|
html = None
|
||
|
return html
|