def get_sections(dept, course): try: sp = SectionParser(dept, course) sections = sp.get_sections() if not sections: abort(404) sections_json = json.dumps(sections) except Exception as e: logger.error(traceback.format_exc()) abort(500) resp = Response(sections_json) resp.headers['Access-Control-Allow-Origin'] = '*' return resp
#! /usr/bin/python from parsers import SectionParser from pprint import pprint sp = SectionParser("CPSC","213") pprint(sp.get_sections()) sp = SectionParser("PSYC","350A") pprint(sp.get_sections()) sp = SectionParser("ENGL","301") pprint(sp.get_sections())