Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

vaibhav

By: a guest on Mar 10th, 2009  |  syntax: Python  |  size: 0.83 KB  |  hits: 27  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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)