python - Website Scraping with BeautifulSoup : TypeError: 'NoneType' object is not callable -


i absolute beginner. try use beautifulsoup , scrape website. html, divs have class content_class.

here attempt:

import requests beautifulsoup import beautifulsoup  #request page , parse html url = 'mywebsite' response = requests.get(url) html = response.content  #beautiful soup soup = beautifulsoup(html) soup.find_all('div', class_="content_class") 

this not work however. get:

traceback (most recent call last): file "scrape.py", line 11, in soup.find_all('div', class_="content_class") typeerror: 'nonetype' object not callable

what doing wrong?

you using beautifulsoup version three, appear following documentation beautifulsoup version four. element.find_all() method available in latest major version (it called element.findall() in version 3).

i urge upgrade:

pip install beautifulsoup4 

and

from bs4 import beautifulsoup 

version 3 has stopped receiving updates in 2012; severely out of date now.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -