Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
simple python script for getting report card form birjand university of technology portal
# its just for command line geeks!
# Enter your username and password and run reportcard_but.py :)
# I got tired to loging and refreshing my university portal!
#try to make my and my friends life much easer with this simple script
#if you are developer u can use my functions to develope application or bot for university portal, MAKE ME HAPPY with that :)
import requests,hashlib,pickle
from bs4 import BeautifulSoup
def get_session(username, password):
md5 = hashlib.md5()
passw=str(password)
user =str(username)
md5.update(passw)
head={'UserID': user ,'UserPassword':md5.hexdigest() , 'pswdStatus': 'strong', 'DummyVar': ''}
url = 'http://puya.birjandut.ir/gateway/UserInterim.php'
page = requests.post(url, data=head)
s = requests.Session()
response = s.post(url, data=head)
return requests.utils.dict_from_cookiejar(s.cookies)
def grade_show(session):
num = requests.get('http://puya.birjandut.ir/educ/educfac/stuShowEducationalLogFromGradeList.php',cookies=session)
page = num.text
soup = BeautifulSoup(page,'html')
row = soup.find_all('tr')
report=[]
for r in row:
soup = BeautifulSoup(str(r),'lxml')
table = soup.find_all('td')
one_row=[]
for x in table:
one_row.append(x.string)
report.append(one_row)
return report
# Exp:
# user = 9213312345
# pass = 123456 :-D
## update : cleaning output !
for row in grade_show(get_session('user','pass')):
print " | ".join([(x if x is not None else '') for x in row])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.