improved typing

This commit is contained in:
Mylloon 2022-01-13 23:07:30 +01:00
parent 9046bee352
commit 8ed0d68179
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

16
main.py
View file

@ -1,9 +1,9 @@
from sys import argv
from requests_html import BaseSession as Session
from bs4 import BeautifulSoup
from requests_html import BaseSession, HTMLResponse
from bs4 import BeautifulSoup # Peut-être retiré par les fonctions de requests_html ?
class Universite:
def __init__(self, url, pseudo, motDePasse):
def __init__(self, url: str, pseudo: str, motDePasse: str):
self.url = url
self.loginData = {
"username": pseudo,
@ -12,18 +12,18 @@ class Universite:
"submit": "SE CONNECTER"
}
def maSoupe(self, page):
"""Macro qui utilise le parser HTML de bs4."""
def maSoupe(self, page: HTMLResponse):
"""Macro pour utiliser le parser HTML de bs4."""
return BeautifulSoup(page.content, "html.parser")
def ecrirePageHTML(self, texte):
def ecrirePageHTML(self, texte: str):
"""Affiche la page HTML pour le debug."""
with open("page.html", 'w') as f:
f.write(texte)
def recuperationNotes(self):
def recuperationNotes(self) -> str:
"""Récupère les notes."""
with Session() as session:
with BaseSession() as session:
# login
reponse = session.get(self.url)
soup = self.maSoupe(reponse)