Apr-04-2018, 06:25 AM
Hello,
My current output:![[Image: vcHrG7h]](https://imgur.com/vcHrG7h)
What I want is table with clickable links, eg hyperlinks.
Example of what I want![[Image: doc-list-create-hyperlinks-6.png]](https://d2d42mpnbqmzj3.cloudfront.net/images/stories/doc-excel/list-and-hyperlink-files-in-folder/doc-list-create-hyperlinks-6.png)
Source of table: Here
My code:
My current output:
What I want is table with clickable links, eg hyperlinks.
Example of what I want
![[Image: doc-list-create-hyperlinks-6.png]](https://d2d42mpnbqmzj3.cloudfront.net/images/stories/doc-excel/list-and-hyperlink-files-in-folder/doc-list-create-hyperlinks-6.png)
Source of table: Here
My code:
import csv
import requests
from bs4 import BeautifulSoup
from tabulate import tabulate
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
me = 'MYEMAIL'
password = 'MYPASSWORD'
server = 'smtp.gmail.com:587'
you = 'EMAILTOSEND'
url="https://www.checkpoint.com/advisories/"
r=requests.get(url)
soup=BeautifulSoup(r.content,"lxml")
table = soup.find('table')
with open('a.csv', 'w+', newline='') as f:
writer = csv.writer(f)
for tr in table('tr'):
row = [t.get_text(strip=True) for t in tr(['td', 'th'])]
writer.writerow(row)
html = """{table}"""
with open('a.csv') as input_file:
reader = csv.reader(input_file)
data = list(reader)
html = html.format(table=tabulate(data, headers="firstrow", tablefmt="html"))
message = MIMEMultipart(
"alternative", None, [MIMEText(html,'html')])
message['Subject'] = "Your data"
message['From'] = me
message['To'] = you
server = smtplib.SMTP(server)
server.ehlo()
server.starttls()
server.login(me, password)
server.sendmail(me, you, message.as_string())
server.quit()

![[Image: hmn6ONl.png]](https://i.imgur.com/hmn6ONl.png)