0

I'm trying to login into a website and send an sms with python. I'm using the request module, passing the user name and password. After I have passed that I am unable to judge whether the login has succeeded or not.

url='http://www.connectexpress.in'

headers={"User-Agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"}

s=requests.session() ; s.headers.update(headers)
r=s.get(url) ; soup=BeautifulSoup.BeautifulSoup(r.content)

VIEWSTATE=soup.find(id="__VIEWSTATE")['value']
#VIEWSTATEGENERATOR=soup.find(id="__VIEWSTATEGENERATOR")['value']
EVENTVALIDATION=soup.find(id="__EVENTVALIDATION")['value']

login_data={"__VIEWSTATE":VIEWSTATE,
"__EVENTVALIDATION":EVENTVALIDATION,
"txtUserName":usrNme,
"txtPassword":paswrd,
"submit":'Submit'}

r1=s.post(url, data=login_data)

This is the piece of code that I used and could any one give some ideas ?

Karan Shishoo
  • 2,402
  • 2
  • 17
  • 32
pkv
  • 107
  • 1
  • 11

0 Answers0