# Script to automatically login to Reliance Internet.
# Periodically check for login status, and login if not logged-in.
import time
import urllib
def is_loggedin():
"Check if we are currently logged-in.\
Load the homepage, and if we see the login form, we're not logged-in!"
webpage = urllib.urlopen("http://www.reliancebroadband.co.in/home")
if "authenticateForm" in webpage.read():
return False
return True
def login():
username = "<set_user_name>"
password = "<set_password>"
data = urllib.urlencode({"username": username, "password": password})
url = "http://www.reliancebroadband.co.in/user/refresh/home"
urllib.urlopen(url, data)
while True:
if not is_loggedin():
print time.strftime("%H:%M:%S"), "Not logged in"
login()
else:
print time.strftime("%H:%M:%S"), "Logged in"
time.sleep(50)