Reliance broadband login script - 2011
This is a script which can be run as a cronjob to login to Reliance connection automatically.
You can get the code here http://sprunge.us/eMLG
#!/usr/bin/python2
__author__ = """
NAME: Abhijeet Rastogi (shadyabhi)
Profile: http://www.google.com/profiles/abhijeet.1989
"""
import cookielib
import urllib2
from getpass import getpass
#Enter your username & password here.
username = "myuser"
password = "secert"
#Logging into the SMS Site
url = 'http://reliancebroadband.co.in/reliance/login.do'
#Remember, Cookies are to be handled
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
# To fool way2sms as if a Web browser is visiting the site
opener.addheaders = [('User-Agent','Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20091020 Ubuntu/9.10 (karmic) Firefox/3.5.3 GTB7.0')]
try:
#For sake of taking cookies which will be sent in second request
usock = opener.open(url)
except IOError:
print "Check your ethernet cable"
sys.exit(1)
#Sending login request
request_url = 'http://reliancebroadband.co.in/reliance/login.do?action=doLoginSubmit'
request_data = 'userId='+username+'&password='+password
opener.addheaders = [('Referer','http://reliancebroadband.co.in/reliance/login.do?action=doLoginSubmit')]
try:
sms_sent_page = opener.open(request_url,request_data)
except IOError:
print "Oops, reliance connection taking too much time to respond. Try again."
sys.exit(1)