Advertisement
Guest User

vaibhav

a guest
Mar 10th, 2009
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. # Script to automatically login to Reliance Internet.
  2. # Periodically check for login status, and login if not logged-in.
  3.  
  4. import time
  5. import urllib
  6.  
  7. def is_loggedin():
  8.     "Check if we are currently logged-in.\
  9.      Load the homepage, and if we see the login form, we're not logged-in!"
  10.     webpage = urllib.urlopen("http://www.reliancebroadband.co.in/home")
  11.     if "authenticateForm" in webpage.read():
  12.         return False
  13.     return True
  14.  
  15. def login():
  16.     username = "<set_user_name>"
  17.     password = "<set_password>"
  18.     data = urllib.urlencode({"username": username, "password": password})
  19.     url = "http://www.reliancebroadband.co.in/user/refresh/home"
  20.     urllib.urlopen(url, data)
  21.  
  22. while True:
  23.     if not is_loggedin():
  24.         print time.strftime("%H:%M:%S"), "Not logged in"
  25.         login()
  26.     else:
  27.         print time.strftime("%H:%M:%S"), "Logged in"
  28.     time.sleep(50)
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement