mirror of
https://gitlab.com/moepoi/Quintal-Grabber.git
synced 2024-12-22 22:44:59 +01:00
Update quintal.py
This commit is contained in:
parent
25f32a2b29
commit
77be3c1a33
1 changed files with 44 additions and 41 deletions
|
@ -15,48 +15,51 @@ class QuintalGrabber:
|
|||
|
||||
def __init__(self, id):
|
||||
self.host = "https://quintal.id"
|
||||
self.id = id
|
||||
|
||||
def get_data(self, query=None):
|
||||
endpoint = "/id/api/initial_data/{}/?format=json".format(str(self.id))
|
||||
self.id = str(id)
|
||||
self.endpoint = "/id/api/initial_data/{}/?format=json".format(self.id)
|
||||
try:
|
||||
req = requests.get(self.host + endpoint)
|
||||
data = json.loads(req.text)
|
||||
self.req = requests.get(self.host + self.endpoint)
|
||||
self.data = json.loads(self.req.text)
|
||||
except:
|
||||
print ("Invalid ID")
|
||||
sys.exit()
|
||||
x = {
|
||||
"lastlogin": data["student_class_semester"]["profile"]["user"]["last_login"],
|
||||
"username": data["student_class_semester"]["profile"]["user"]["username"],
|
||||
"firstname": data["student_class_semester"]["profile"]["user"]["first_name"],
|
||||
"lastname": data["student_class_semester"]["profile"]["user"]["last_name"],
|
||||
"email": data["student_class_semester"]["profile"]["user"]["email"],
|
||||
"gender": data["student_class_semester"]["profile"]["gender"],
|
||||
"phonenumber": data["student_class_semester"]["profile"]["mobile_no"],
|
||||
"address": data["student_class_semester"]["profile"]["address"],
|
||||
"city": data["student_class_semester"]["profile"]["city"],
|
||||
"province": data["student_class_semester"]["profile"]["province"],
|
||||
"country": data["student_class_semester"]["profile"]["country"],
|
||||
"profilephoto": self.host + data["student_class_semester"]["profile"]["profile_photo"],
|
||||
"birthdate": data["student_class_semester"]["profile"]["birth_date"],
|
||||
"sectionname": data["student_class_semester"]["section_name"],
|
||||
"gradename": data["student_class_semester"]["grade_name"],
|
||||
"classname": data["student_class_semester"]["class_name"],
|
||||
"i_fullname": data["student_class_semester"]["profile"]["institution"]["full_name"],
|
||||
"i_shortname": data["student_class_semester"]["profile"]["institution"]["short_name"],
|
||||
"i_address": data["student_class_semester"]["profile"]["institution"]["address"],
|
||||
"i_city": data["student_class_semester"]["profile"]["institution"]["city"],
|
||||
"i_province": data["student_class_semester"]["profile"]["institution"]["province"],
|
||||
"i_country": data["student_class_semester"]["profile"]["institution"]["country"],
|
||||
"i_logo": self.host + data["student_class_semester"]["profile"]["institution"]["logo"],
|
||||
"i_domain": data["student_class_semester"]["profile"]["institution"]["sch_domain"]
|
||||
}
|
||||
if query is None:
|
||||
return(x)
|
||||
else:
|
||||
try:
|
||||
xm = x["{}".format(str(query))]
|
||||
return (xm)
|
||||
except Exception as e:
|
||||
xm = "type {} not found".format(str(query))
|
||||
return (xm)
|
||||
|
||||
def get_identity(self):
|
||||
res = self.data["student_class_semester"]
|
||||
return res
|
||||
|
||||
def get_event(self):
|
||||
res = self.data["event_users"]
|
||||
return res
|
||||
|
||||
def get_payment(self):
|
||||
res = self.data["payments"]
|
||||
return res
|
||||
|
||||
def get_assignment(self):
|
||||
res = self.data["assignment_class_semester_subject_submissions"]
|
||||
return res
|
||||
|
||||
def get_test(self):
|
||||
res = self.data["test_class_semester_subject_submissions"]
|
||||
return res
|
||||
|
||||
def get_settings(self):
|
||||
res = self.data["section_settings"]
|
||||
return res
|
||||
|
||||
def get_subjects(self):
|
||||
res = self.data["student_class_semester_subjects"]
|
||||
return res
|
||||
|
||||
def get_materials(self):
|
||||
res = self.data["materials"]
|
||||
return res
|
||||
|
||||
def get_announcements(self):
|
||||
res = self.data["announcement_users"]
|
||||
return res
|
||||
|
||||
def get_schedule(self):
|
||||
res = self.data["class_timetable_periods"]
|
||||
return res
|
Loading…
Reference in a new issue