import requests import re LOGIN_URL = "https://portal.dhivehinet.net.mv/adsls/login_api" HOME_URL = "https://portal.dhivehinet.net.mv/home" #The creds DHIRAAGU_USERNAME="" DHIRAAGU_PASSWORD="" NOIP_USERNAME="" NOIP_PASSWORD="" NOIP_DOMAIN="" def login(username= DHIRAAGU_USERNAME, password=DHIRAAGU_PASSWORD): headers = {'Content-Type': 'application/x-www-form-urlencoded'} form_data = {"data[adsl][username]": username, "data[adsl][password]": password} login_req = requests.post(LOGIN_URL,headers=headers, data=form_data) # 200 means the creds are correct if login_req.status_code == 200: cookie = login_req.cookies home_page = requests.get(HOME_URL,cookies=cookie) #get the home page with the returned cookie return home_page.text else: return False #tries to find ip address from the homepage with regex def getIp(string): #tries to filter so it will work if two ip matches are found results = re.findall('