def test_valid_course(course_mnemo="INFOH500"): gehol_proxy = GeholProxy("164.15.72.157:8081") print "Fetching events for course : %s" % course_mnemo calendar = gehol_proxy.get_course_calendar(course_mnemo) print "Result : " print calendar print calendar.events
def make_ical_from_groupid(group_id): gehol_proxy = GeholProxy() cal = gehol_proxy.get_studentset_calendar(group_id, "1-14") ical = convert_geholcalendar_to_ical(cal, first_monday) ical_data = ical.as_string() outfile = "%s.ics" % ical.name print "writing ical file : %s" % outfile write_content_to_file(ical_data, outfile)
def make_ical_from_url(name, url): gehol_proxy = GeholProxy() cal = gehol_proxy.get_studentset_calendar_from_url(url) ical = convert_geholcalendar_to_ical(cal, first_monday) ical_data = ical.as_string() outfile = "%s.ics" % name print "writing ical file : %s" % outfile write_content_to_file(ical_data, outfile)
def test_nonexistent_course(): course_mnemo = "INFOH999" print "Fetching events for non existent course : %s" % course_mnemo gehol_proxy = GeholProxy("164.15.72.157:8081") try: calendar = gehol_proxy.get_course_calendar(course_mnemo) except Exception, e: print "Non existent course %s was not found" % course_mnemo print "Reason : ", e.message
import sys sys.path.append("../src") from gehol import GeholProxy from gehol.converters.utils import write_content_to_file from gehol.converters.rfc5545icalwriter import convert_geholcalendar_to_ical if __name__=="__main__": print 'import calendar test --> csv files' all_courses = ['INFOH500','BIMEH404','STATH400', 'COMMB411', 'TRANH100', 'INFOH100', 'TRANH100'] host = '164.15.72.157:8081' first_monday = '19/09/2011' gehol_proxy = GeholProxy(host) for course in all_courses: print "fetching events for course %s" % course cal = gehol_proxy.get_course_calendar(course) dest_filename = '%s.ics' % course ical = convert_geholcalendar_to_ical(cal, first_monday) print "Saving %s events to %s" % (course, dest_filename) ical_data = ical.as_string() write_content_to_file(ical_data, dest_filename)
def test_course_url(url): gehol_proxy = GeholProxy() calendar = gehol_proxy.get_course_calendar_from_url(url) print "Result : %s" % calendar