Пытаюсь парсить сайт, но не получается
import urllib.request
from bs4 import BeautifulSoup
def get_html(url):
response = urllib.request.urlopen(url)
return response.read()
def parse(html):
soup = BeautifulSoup(html)
table = soup.find('table', class_='row')
print(table.prettify())
def main():
parse(get_html('https://www.weblancer.net/projects/'))
if __name__ == '__main__':
main()
мне выдает предупреждение:
Warning (from warnings module):
File “C:\Python34\lib\site-packages\beautifulsoup4-4.4.1-py3.4.egg\bs4\__init__.py”, line 166
UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system (“html.parser”). 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.
To get rid of this warning, change this:
BeautifulSoup()
to this:
BeautifulSoup(, “html.parser”)
Traceback (most recent call last):
File “C:\Users\Simpson\Documents\Парсер\google\google.py”, line 18, in <module>
main()
File “C:\Users\Simpson\Documents\Парсер\google\google.py”, line 14, in main
parse(get_html('
https://www.weblancer.net/projects/'))
File “C:\Users\Simpson\Documents\Парсер\google\google.py”, line 11, in parse
print(table.prettify())
AttributeError: ‘NoneType’ object has no attribute ‘prettify’
У меня установлена win7.
Как мне избежать этого предупреждения? Пожалуйста подскажите.