import smtplib, ssl import requests from bs4 import BeautifulSoup email="josedeception00@gmail.com" port = 465 password = "honeypot2020" s= requests.Session() r=s.get('http://localhost/moodle/login/index.php') soup = BeautifulSoup(r.text, 'html.parser') logintoken = soup.find('input', {"name": "logintoken"} )['value'] login_data= {'logintoken':logintoken,'username':'dummy1' ,'password': 'Dummy@123'} s.post('http://localhost/moodle/login/index.php', login_data) url = 'http://localhost/moodle/user/profile.php?id=5' r= s.get(url) soup = BeautifulSoup(r.text, 'html.parser') time=soup.find_all('dd') time=time[3] print(time) requests.Session().close()