Created
July 23, 2015 08:28
-
-
Save iamareebjamal/070fe6bb980e252621f7 to your computer and use it in GitHub Desktop.
Python Script to see attendance of AMU B.Tech students by providing Faculty Number.
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 requests | |
from bs4 import BeautifulSoup | |
fac_no = input('Enter Faculty Number:') | |
data = {'faculty_number' : fac_no, 'submit' : 'submit'} | |
page = requests.post('http://ctengg.amu.ac.in/student_wise_attendance.php', data) | |
attendance = BeautifulSoup(page.text).findAll('table')[0] | |
index = attendance.text.find('Name') + len('Name') | |
while attendance.text[index] == ' ': | |
index+=1 | |
last = attendance.text.find('Faculty') | |
name = attendance.text[index : last] | |
print(name) | |
for i in range(7): | |
data = attendance.findAll('tr')[i].findAll('td') | |
sub = data[0].text | |
total = data[1].text | |
present = data[2].text | |
perc = '%-4s' % data[3].text | |
data = {'file' : sub, 'submit' : 'submit'} | |
date_page = requests.post('http://ctengg.amu.ac.in/check_attendance_btech.php', data) | |
data = BeautifulSoup(date_page.text) | |
date = 'Not available' | |
if 'uploaded' in data.text : | |
index = data.text.find('on ') + len('on ') | |
last = data.text.find(' by') | |
date = data.text[index:last] | |
print(sub + ' ' + total + ' ' + present + ' ' + perc + ' ' + date) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment