Exemplo n.º 1
0
def get_timetable():
    cookie = request.cookies.get('JSESSIONID')
    sno = request.cookies.get('sno')
    year, term = [request.args[x] for x in ['year', 'term']]
    _, result = sysujwxt.get_timetable(cookie.encode('ascii'),
                                       year.encode('ascii'),
                                       term.encode('ascii'))
    return result
Exemplo n.º 2
0
def get_timetable():
    cookie = request.cookies.get('JSESSIONID')
    sno = request.cookies.get('sno')
    year, term = [request.args[x] for x in ['year', 'term']]
    _, result = sysujwxt.get_timetable(cookie.encode('ascii'),
                                       year.encode('ascii'),
                                       term.encode('ascii'))
    return result
Exemplo n.º 3
0
 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')
Exemplo n.º 4
0
def get_table(username, password, year, term):
    cookie = fakesysujwxt.login( username, password )
    if cookie[ 0 ] == True:
        cookie = cookie[ 1 ]
    else:
        print "password mismatch!"
        return -1
    result = fakesysujwxt.get_timetable( cookie.encode('ascii'),
                                     year.encode('ascii'),
                                     term.encode('ascii'))
    if result[ 0 ] == True:
        result = result[ 1 ]
    course = re.findall( r'jc=\'(?P<jc>.*?)\'.*?kcmc=\'(?P<kcmc>.*?)\'.*?dd=\'(?P<dd>.*?)\'.*?zfw=\'(?P<zfw>.*?)\'.*?weekpos=(?P<weekpos>.*?);', result, re.S )
    ret = [ { "time": match[ 0 ] , "course_name": match[ 1 ], "location": match[ 2 ], "duration": match[ 3 ], "week_pos": match[ 4 ] } for match in course ]
    return ret
Exemplo n.º 5
0
def get_table(username, password, year, term):
    cookie = fakesysujwxt.login(username, password)
    if cookie[0] == True:
        cookie = cookie[1]
    else:
        print "password mismatch!"
        return -1
    result = fakesysujwxt.get_timetable(cookie.encode('ascii'),
                                        year.encode('ascii'),
                                        term.encode('ascii'))
    if result[0] == True:
        result = result[1]
    course = re.findall(
        r'jc=\'(?P<jc>.*?)\'.*?kcmc=\'(?P<kcmc>.*?)\'.*?dd=\'(?P<dd>.*?)\'.*?zfw=\'(?P<zfw>.*?)\'.*?weekpos=(?P<weekpos>.*?);',
        result, re.S)
    ret = [{
        "time": match[0],
        "course_name": match[1],
        "location": match[2],
        "duration": match[3],
        "week_pos": match[4]
    } for match in course]
    return ret
Exemplo n.º 6
0
 def test_get_timetable(self):
     success, result = fakesysujwxt.get_timetable(self.cookie, self.year, self.term)
     self.assertTrue(success)