Skip to content

Instantly share code, notes, and snippets.

@amalaugustinejose
Created June 5, 2017 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalaugustinejose/2896a6fda623f9629a6ca127f975354f to your computer and use it in GitHub Desktop.
Save amalaugustinejose/2896a6fda623f9629a6ca127f975354f to your computer and use it in GitHub Desktop.
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