I am not sure why I am getting an error message AttributeError: 'NoneType' object has no attribute 'text' while running a code in Python 2 on WebScraping using BeautifulSoup?
Error message :
AttributeError Traceback (most recent call last)
in ()
----> 1 name = name_box.text.strip()
AttributeError: 'NoneType' object has no attribute 'text'
Following is my code:
from bs4 import BeautifulSoup
import requests
import csv
source = requests.get('http://coreyms.com').text
soup = BeautifulSoup(source, 'lxml')
name_box = soup.find('h1', attrs = {'class': 'name'})
name = name_box.text.strip()
Could you please help. Thanks!