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