from urllib.request import urlopen from urllib.error import HTTPError from bs4 import BeautifulSoup
defdownload(url): print('Downloading:',url) try: html = urlopen(url) except HTTPError as e: print('Download error:',e) html = None return html
html = download('https://www.sail.name/') bsObj = BeautifulSoup(html.read()) print(bsObj)
1 2 3 4 5 6 7 8 9 10 11
UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 16 of the file one.py. To get rid of this warning, change code that looks like this: