def get_score(): sno = request.cookies.get('sno') cookie = request.cookies.get('JSESSIONID') year = request.args.get('year', '') term = request.args.get('term', '') _, result = sysujwxt.get_score(cookie.encode('ascii'), sno.encode('ascii'), year.encode('ascii'), term.encode('ascii')) return result
def test_expired_queries(self): success, result = fakesysujwxt.get_score(self.cookie[::-1], self.sno, self.year, self.term) self.assertEqual(result, 'expired') success, result = fakesysujwxt.get_timetable(self.cookie[::-1], self.year, self.term) self.assertEqual(result, 'expired') success, result = fakesysujwxt.get_available_courses(self.cookie[::-1], self.year, self.term, '30', '1') self.assertEqual(result, 'expired') success, result = fakesysujwxt.get_course_result(self.cookie[::-1], self.year, self.term) self.assertEqual(result, 'expired') success, result = fakesysujwxt.get_earned_credit(self.cookie[::-1], self.sno, self.year, self.term) self.assertEqual(result, 'expired') success, result = fakesysujwxt.get_gpa(self.cookie[::-1], self.sno, self.year, self.term) self.assertEqual(result, 'expired')
def test_get_score(self): success, result = fakesysujwxt.get_score(self.cookie, self.sno, self.year, self.term) self.assertTrue(success)
elif s >= 2.0: return 2.7 def add_score(jd, xf, score): jd += [ toronto(float(i["jd"])) for i in score["body"]["dataStores"]["kccjStore"]["rowSet"]["primary"] ] xf += [ float(i["xf"]) for i in score["body"]["dataStores"]["kccjStore"]["rowSet"]["primary"] ] if __name__ == "__main__": username = sys.argv[1] password = sys.argv[2] _, cookie = fakesysujwxt.login(username, password) jd = [] xf = [] year_start = 2011 for yy in range(2): for term in range(1, 4): year = "%d-%d" % (year_start + yy, year_start + yy + 1) raw_score = fakesysujwxt.get_score(cookie, username, year, term)[1] score = json.loads(fakesysujwxt.format_to_json(raw_score)) add_score(jd, xf, score) a = sum([i * j for i, j in zip(jd, xf)]) print a / sum(xf)
if s >= 3.5: return 4.0 elif s >= 3.0: return 3.7 elif s >= 2.7: return 3.3 elif s >= 2.3: return 3.0 elif s >= 2.0: return 2.7 def add_score(jd, xf, score): jd += [toronto(float(i["jd"])) for i in score["body"]["dataStores"]["kccjStore"]["rowSet"]["primary"]] xf += [float(i["xf"]) for i in score["body"]["dataStores"]["kccjStore"]["rowSet"]["primary"]] if __name__ == "__main__": username = sys.argv[1] password = sys.argv[2] _, cookie = fakesysujwxt.login(username, password) jd = [] xf = [] year_start = 2011 for yy in range(2): for term in range(1, 4): year = "%d-%d" % (year_start + yy, year_start + yy + 1) raw_score = fakesysujwxt.get_score(cookie, username, year, term)[1] score = json.loads(fakesysujwxt.format_to_json(raw_score)) add_score(jd, xf, score) a = sum([i * j for i, j in zip(jd, xf)]) print a / sum(xf)