import collections from uwaterlooapi import UWaterlooAPI uw = UWaterlooAPI(api_key="938d42adae6cc93ed580450aef4cdbba") # TAKES ABOUT 10 MINUTES TO RUN # .txt files must be changed into appropriate .json files big_list = uw.courses() course_titles = {} big_dict = {} big_dict2 = {} # A Course is a String # A Prereq is one of: # * list (Course) # * listof (1, listof(Course)) # e.g. : ['MATH 106'] # [1, 'CS115', 'CS135'] # [[1, 'MATH235', 'MATH245'], [1, 'MATH237', 'MATH247']] # Takes a list of prereqs and turns it into a listof (Course) def filter_prereqs(lst): re = [] if len(lst) > 0 and (lst[0] == 1 or lst[0] == 2 or lst[0] == 3): del lst[0]
from uwaterlooapi import UWaterlooAPI from pprint import pprint import xlsxwriter if __name__ == '__main__': wb = xlsxwriter.Workbook('test.xlsx') sheet = wb.add_worksheet() uw = UWaterlooAPI(api_key="7d0e829ff82a1aa902f44d6609a1cbb2") courses = uw.courses() count = 0 for course in courses: sheet.write('A%d' % count, course['subject']) sheet.write('B%d' % count, course['catalog_number']) sheet.write('C%d' % count, course['title']) count += 1 wb.close()