Add comments
This commit is contained in:
parent
69d7a7d2ad
commit
3464da3c9e
1 changed files with 11 additions and 5 deletions
16
main.py
16
main.py
|
@ -13,13 +13,16 @@ class Universite:
|
||||||
}
|
}
|
||||||
|
|
||||||
def maSoupe(self, page):
|
def maSoupe(self, page):
|
||||||
|
"""Macro qui utilise le parser HTML de bs4."""
|
||||||
return BeautifulSoup(page.content, "html.parser")
|
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:
|
with open("page.html", "w") as f:
|
||||||
f.write(texte) """
|
f.write(texte)
|
||||||
|
|
||||||
def recuperationNotes(self):
|
def recuperationNotes(self):
|
||||||
|
"""Récupère les notes."""
|
||||||
with Session() as session:
|
with Session() as session:
|
||||||
# login
|
# login
|
||||||
reponse = session.get(self.url)
|
reponse = session.get(self.url)
|
||||||
|
@ -38,11 +41,14 @@ class Universite:
|
||||||
url = reponse.headers["Location"]
|
url = reponse.headers["Location"]
|
||||||
reponse = session.get(url)
|
reponse = session.get(url)
|
||||||
|
|
||||||
# page des notes
|
# choix des années
|
||||||
soup = self.maSoupe(reponse)
|
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)
|
reponse = session.get(url)
|
||||||
# self.ecrirePageHTML(reponse.text)
|
self.ecrirePageHTML(reponse.text)
|
||||||
|
|
||||||
|
# page des notes
|
||||||
|
# TODO
|
||||||
|
|
||||||
# récupération tableaux des notes
|
# récupération tableaux des notes
|
||||||
soup = self.maSoupe(reponse)
|
soup = self.maSoupe(reponse)
|
||||||
|
|
Reference in a new issue