from bs4 import BeautifulSoup try:
html = urlopen("https://www.sapo.pt/")
except HTTPError as e:
print(e)
except URLError:
print("Server down or incorrect domain")
else:
res = BeautifulSoup(html.read(),"html")
tags = res.findAll("h3", {"class": "no-margin-bottom"})
for tag in tags:
print(tag.getText())