How do I solve this error?
Code
def sv():
url = url2
resp=requests.get(url)
if resp.status_code==200:
print("Managed to connect to the website.")
print("Info :-\n")
soup=BeautifulSoup(resp.text,'html.parser')
l=soup.find("h2",{"class":"etikett bottom-spacing-medium"})
for i in l.findAll("a"):
print(i.text)
else:
print("Error")
sv()
Error
Traceback (most recent call last):
File "c:\Users\----\Desktop\Python\Biler.py", line 41, in <module>
sv()
File "c:\Users\----\Desktop\Python\Biler.py", line 36, in sv
for i in l.findAll("a"):
AttributeError: 'NoneType' object has no attribute 'findAll'
QUESTION
Ive been stuck on this error for a while. Anyone know how to fix the error.