Created
June 5, 2017 18:08
-
-
Save amalaugustinejose/2896a6fda623f9629a6ca127f975354f to your computer and use it in GitHub Desktop.
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 urllib2, urllib, os | |
print "Result Downloader" | |
count = 0 | |
sta_no = int(raw_input("Enter First Reg Number : ")) | |
end_no = int(raw_input("Enter Last Reg Number : ")) | |
for i in xrange(int(sta_no), int(end_no)): | |
data = urllib.urlencode({'exam': '59', 'prn': i}) | |
req = urllib2.Request('http://projects.mgu.ac.in/bTech/btechresult/index.php?module=public&attrib=result&page=result', data) | |
if (req == urllib2.URLError): | |
continue | |
print "record for %d not found" %i | |
else: | |
count += 1 | |
print "downloading :%d.pdf" %i | |
with open(os.path.basename("%d.pdf" %i), "wb") as local_file: | |
local_file.write(urllib2.urlopen(req).read()) | |
print "%d reults downloaded :). See your home directory" %count | |
#Created by Amal Augustine Jose on 05/06/2017 | |
#Enter first registration number and last registration number on prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment