def login(request): if 'regclass' in request.session: return HttpResponseRedirect('/main') if request.method == 'GET': return HttpResponseRedirect('/') username = request.POST['username'] password = request.POST['password'] try: regclass = reglib.infosu(username, password, True) request.session['regclass'] = regclass request.session.set_expiry(1200) return HttpResponseRedirect('/main') except: return HttpResponseRedirect('/')
import reglib ############### # INSTANTIATION ############### reg_class = reglib.infosu('930608334', '121088') #print reg_class #result = reg_class.make_schedule(['ph 212'],'F11') #for course in result: # print course #for index, combination_list in enumerate(results): # print "Combination " + str(index+1) # for combination in combination_list: # print combination['Type'] + ' ' + combination['Dep'] + ' ' + combination['Num'] + ' ' + ('').join(combination['Day/Time/Date']['Days']) + ' ' + ('-').join(combination['Day/Time/Date']['Time']) + ' CRN: ' + combination['CRN'] # print ############## # TRANSCRIPT ############## #reg_class.get_transcript() #print reg_class.transcript.sort_by_term() #print reg_class.transcript.credits #print reg_class.transcript.has_class('ph', '211') # Summary of class already passed #print reg_class.transcript.has_passed_class('ph', '212') # Boolean #print reg_class.transcript.grade_distribution() ######### #SCHEDULE ######### #print reg_class.schedule.current_term