I am trying to get href link from a tag but when I use method .get
it gives me error "non type object has no attribute get"
here is my code:
#Loading Libraries
import urllib
import urllib.request
from bs4 import BeautifulSoup
#define URL for scraping
theurl = "http://www.techspot.com/"
thepage = urllib.request.urlopen(theurl)
#Cooking the Soup
soup = BeautifulSoup(thepage,"html.parser")
i=1
#Scraping "Project Title" (project-title)
title = soup.findAll('div', {'class': 'article-category'})
for titles in title:
titleheading = soup.findAll('h2')
for titletext in titleheading:
titlename = titletext.a
titlelink =titlename.get('href')
print(i)
print(titlelink)
i+=1
and here is the console screenshot of the error I am getting
Tell me what's the problem in this code or why i am getting this error