Login Register


Ajax submitted Web Form data extraction using urllib2 filter_list
Author
Message
Ajax submitted Web Form data extraction using urllib2 #1
Hello Guys,


I am relatively new to python and hasn't got much to do around it. I read a few things about the urllib and urllib2 library of python. Actually I was inspired by @Ligeti 's project and thought if making something useful.

Now there is a site suppose :-

http://www.somesite.com/login.php

Now there is a login form and when I fill up the form and submit it a new table is generated via the Ajax request and we can see the data. But we are not redirected to other page but same page. I tried to scrape the data but I am not getting it. Even after the login when I see the page source it still contains the login form code. Then in what manner can I extract the data after the new data are set by the Ajax call.


I did something like this to get the whole of the html source after the form is submitted but it only gives me the code of the login page :-

Code:
import mechanize url = "http://www.somesite.com/login.php" br = mechanize.Browser() br.set_handle_robots(False) # ignore robots br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0')] br.open(url) br.select_form(name="frmdetails") br["Username"] = "Test" br["Password"] = "1234" res = br.submit() content = res.read() print content


Can you tell me if there is a way to do so ?
[Image: OilyCostlyEwe.gif]

Reply

Ajax submitted Web Form data extraction using urllib2 #2
Hello Guys,


I am relatively new to python and hasn't got much to do around it. I read a few things about the urllib and urllib2 library of python. Actually I was inspired by @Ligeti 's project and thought if making something useful.

Now there is a site suppose :-

http://www.somesite.com/login.php

Now there is a login form and when I fill up the form and submit it a new table is generated via the Ajax request and we can see the data. But we are not redirected to other page but same page. I tried to scrape the data but I am not getting it. Even after the login when I see the page source it still contains the login form code. Then in what manner can I extract the data after the new data are set by the Ajax call.


I did something like this to get the whole of the html source after the form is submitted but it only gives me the code of the login page :-

Code:
import mechanize url = "http://www.somesite.com/login.php" br = mechanize.Browser() br.set_handle_robots(False) # ignore robots br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0')] br.open(url) br.select_form(name="frmdetails") br["Username"] = "Test" br["Password"] = "1234" res = br.submit() content = res.read() print content


Can you tell me if there is a way to do so ?
[Image: OilyCostlyEwe.gif]

Reply

RE: Ajax submitted Web Form data extraction using urllib2 #3
Can someone help me a bit regarding this ? its been two days since I posted this.

Any help would be appreciated!
[Image: OilyCostlyEwe.gif]

Reply

RE: Ajax submitted Web Form data extraction using urllib2 #4
Can I have some help here ?
[Image: OilyCostlyEwe.gif]

Reply







Users browsing this thread: 1 Guest(s)