diff --git a/main.py b/main.py index 24c8009..5b13e89 100644 --- a/main.py +++ b/main.py @@ -13,13 +13,16 @@ class Universite: } def maSoupe(self, page): + """Macro qui utilise le parser HTML de bs4.""" return BeautifulSoup(page.content, "html.parser") - """ def ecrirePageHTML(self, texte): # Utilisé pour du DEBUG + def ecrirePageHTML(self, texte): + """Affiche la page HTML pour le debug.""" with open("page.html", "w") as f: - f.write(texte) """ + f.write(texte) def recuperationNotes(self): + """Récupère les notes.""" with Session() as session: # login reponse = session.get(self.url) @@ -38,11 +41,14 @@ class Universite: url = reponse.headers["Location"] reponse = session.get(url) - # page des notes + # choix des années soup = self.maSoupe(reponse) - url = f"{url}?{soup.find('form', attrs = {'enctype': 'application/x-www-form-urlencoded'})['action'].split('?')[1].replace('welcome', 'detailnotes')}" + url = f"{url}?{soup.find('form', attrs = {'enctype': 'application/x-www-form-urlencoded'})['action'].split('?')[1].replace('welcome', 'notes')}" reponse = session.get(url) - # self.ecrirePageHTML(reponse.text) + self.ecrirePageHTML(reponse.text) + + # page des notes + # TODO # récupération tableaux des notes soup = self.maSoupe(reponse)