[BangPypers] Auto Login to Website and Capturing more details

Noufal Ibrahim noufal at gmail.com
Thu Dec 22 17:57:20 CET 2011


Nikunj Badjatya <nikunjbadjatya at gmail.com> writes:

> Hi All,
>
> I am trying to use Python power in my daily life.
> Do you have Airtel Broadband Connection ? YES / NO ? In either case..read
> on. !
> I am trying to write a script which will automatically login to Airtel page
> https://ebpp.airtelworld.com/cares/wps/myportal
> Then go to "account information -> <DSL Account> -> View Unbilled
> Information"
> And prints the details of unbilled information.
>
> Can anyone guide me on this.? How to start etc.
> The site is definitely javascript based ( Please correct if I am
> wrong! )

You're probably right. People just love to use JS to make their sites
"Web 2.0" these days but it's something we screen scrapers have to deal
with. 

Here are my comments from a quick examination using Firebug (which is
something you should have handy to investigate stuff like this). 

The login attempt POSTs your data to 
https://ebpp.airtelworld.com/pkmslogin.form

which returns a secure cookie that should probably be sent in subsequent
requests to handle your session. 

This is probably the first thing you need to do. The Python stdlib can
handle this using urllib2 and cookielib. I've managed something like
this here https://gist.github.com/3811b566df4005a012c7 which you can use
as a starting point. 

After this, you have a session. Now you should be able to GET the URL
you want directly and parse it for the information you need.


[...]


-- 
~noufal
http://nibrahim.net.in

Evil isn't all bad.


More information about the BangPypers mailing list