Created
August 15, 2016 20:53
-
-
Save axlevisu/4403f93cc5a863d206e69738c8bb2abb to your computer and use it in GitHub Desktop.
srcipt used to get rollnumber through date of birth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from mechanize import Browser | |
br = Browser() | |
# Ignore robots.txt | |
br.set_handle_robots( False ) | |
# Google demands a user-agent that isn't a robot | |
br.addheaders = [('User-agent', 'Firefox')] | |
# Retrieve the Google home page, saving the response | |
br.open( "http://resultsarchives.nic.in/cbseresults/cbseresults2013/jee_main/jee_cbse_2013.htm" ) | |
# Select the search box and search for 'foo' | |
for i in xrange(80530460,80539999): | |
br.select_form( 'FrontPage_Form1' ) | |
# br.form[ 'regno' ] = '80525759' | |
br.form[ 'regno' ] = str(i) | |
br.form[ 'dob' ] = '28/08/1996' | |
# Get the search results | |
response =br.submit() | |
content = response.read() | |
# print content | |
if content.find('Sorry, The Roll Number is not Valid.') == -1: | |
print i | |
br.back() | |
# break | |
# print br. | |
else: | |
br.back() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment