From 3464da3c9ea9bb6d8f73a486edea7c8cded1145e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 13 Jan 2022 22:52:32 +0100 Subject: [PATCH] Add comments --- main.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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)