improved typing
This commit is contained in:
parent
9046bee352
commit
8ed0d68179
1 changed files with 8 additions and 8 deletions
16
main.py
16
main.py
|
@ -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)
|
||||
|
|
Reference in a new issue