Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from getpass import getpass
- from terminaltables import AsciiTable
- username = input("Unesite username: ")
- password = getpass()
- session = requests.Session()
- login = session.post("https://eportal.pmf.uns.ac.rs/ePMFWebServisi/login",
- json={"username": username, "password":password })
- username = login.json().get("username")
- token = login.json().get("authtoken")
- session.headers.update({"username":username, "authtoken":token})
- data = session.get("https://eportal.pmf.uns.ac.rs/ePMFWebServisi/ispiti/getIspitiTekuciPlan")
- ispiti = data.json()
- zbirOcena = 0
- zbir = 0
- table_data = [['Predmet', "Ocena", "espb"]]
- for ispit in ispiti:
- table_data.append([ispit.get('naziv'), ispit.get('ocena'), ispit.get('espb')])
- zbir += ispit.get('espb')
- zbirOcena += int(ispit.get('ocena'))
- table_data.append(['', zbirOcena/len(ispiti), zbir])
- table_view = AsciiTable(table_data)
- table_view.inner_footing_row_border = True
- print(table_view.table)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement