예제 #1
0
 def test_request_data(self):
     
     working_url = 'http://courses.illinois.edu/cisapp/explorer/schedule/2012/spring/AAS.xml'
     
     correct_data = open('test_data/spring2012aas.xml').read()
     results = MyIllinoisXMLRequest.get_data(working_url)
     
     self.assertEquals(results, correct_data)
예제 #2
0
 def request_data(year, term, code, course_id, crn):
     
     URLInfo = namedtuple('URLInfo', 'year term code course_id crn')
     
     url_info = URLInfo(year, term, code, course_id, crn)
     
     xml_data = MyIllinoisXMLRequest.get_data(url_info)
     if xml_data == None:
         return None
     
     return xml_data
예제 #3
0
파일: Subject.py 프로젝트: timm3/classTable
 def get_children(self):
     
     classes = []
     for course_id in self.course_ids:
         url_info = URLInfo(self.year, self.term, self.code, course_id, None)
        
         class_data = MyIllinoisXMLRequest.get_data(url_info)
         if class_data == None:
             continue
         
         parsed_class_data = XMLReader.extract_class_general_data(class_data)
         class_general = ClassGeneral(parsed_class_data)
         classes.append(class_general)
         
     return classes
예제 #4
0
 def get_children(self):
     
     terms = []
     url_info = URLInfo(self.year, None, None, None, None)
     
     term_data = MyIllinoisXMLRequest.get_data(url_info)
     if term_data == None:
         return None
     
     parsed_term_data = XMLReader.extract_terms_data(term_data)
     if parsed_term_data != None:
         for t in parsed_term_data:
             term = Term(t)
             terms.append(term)
     
     return terms
예제 #5
0
    def get_children(self):

        subjects = []

        url_info = URLInfo(self.year, self.term, None, None, None)
        subject_data = MyIllinoisXMLRequest.get_data(url_info)

        if subject_data == None:
            return None

        parsed_subject_data = XMLReader.extract_subjects_data(subject_data)

        for s in parsed_subject_data:
            subject = Subject(s)
            subjects.append(subject)

        return subjects
예제 #6
0
    def get_children(self):

        URLInfo = namedtuple("URLInfo", "year term code course_id crn")
        sections = []

        for crn in self.crns:
            url_info = URLInfo(self.year, self.term, self.code, self.course_id, crn)

            section_data = MyIllinoisXMLRequest.get_data(url_info)
            if section_data == None:
                continue

            parsed_section_data = XMLReader.extract_section_data(section_data)
            class_section = ClassSection(parsed_section_data)

            sections.append(class_section)

        return sections
예제 #7
0
    def test_build_url(self):
        
        url_info = URLInfo('2013', 'spring', 'AAS', None, None)
        url = MyIllinoisXMLRequest.build_url(url_info)

        self.assertEqual('http://courses.illinois.edu/cisapp/explorer/schedule/2013/spring/AAS.xml', url)