Пример #1
0
    def downloadPSSOPage(self):
        username = self.lineEdit.text()
        password = self.lineEdit_2.text()
        login_url = 'https://psso.fh-koeln.de/qisserver/rds?state=user&type=1&category=auth.login&startpage=portal.vm&breadCrumbSource=portal'
        params = urllib.urlencode({'asdf': username, 'fdsa': password, 'submit':'Login'}) # lol
        html_1 = urllib.urlopen(login_url, params).read()

        if not noten.checkLogin(html_1):
            self.showErrorPopup(u"Sind die Login Daten möglicherweise falsch?")
            return
        try:
            # Von hier an simulieren wir einen Crawler
            html_2 = urllib.urlopen(noten.getLinkByName(html_1, "Prüfungsverwaltung")).read()
            html_3 = urllib.urlopen(noten.getLinkByName(html_2, "Notenspiegel")).read()
            html_4 = urllib.urlopen(noten.getLinkByName(html_3, re.compile("Abschluss"))).read()
            html_5 = urllib.urlopen(noten.getLinkByGraphic(html_4, "/QIS/images//his_info3.gif")).read()
        except TypeError as e:
           self.showErrorPopup(u"Scheinbar haben sich die PSSO Seiten verändert… Sag' bitte Hugo bescheid, damit er das Programm reparieren kann!")
           return
        try:
            anz_noten, anz_credits, schnitt = noten.getInfos(html_5)
            name = noten.getStudentName(html_5)
            self.presentResults(anz_noten, anz_credits, schnitt, name)
        except noten.ParsingError as e:
            self.showErrorPopup(str(e))
Пример #2
0
 def openFileDialog(self):
     html_file = QtGui.QFileDialog.getOpenFileName(None, u"HTML Datei auswählen", filter="HTML-Datei (*.html *.htm)")
     html_file = unicode(html_file)
     if html_file:
         try:
             f = codecs.open(html_file, encoding='utf-8')
             anz_noten, anz_credits, schnitt = noten.getInfos(f.read())
             name = noten.getStudentName(open(html_file).read())
             self.presentResults(anz_noten, anz_credits, schnitt, name)
         except noten.ParsingError as e:
             self.shoeErrorPopup(str(e))