From 7112858874bec2ac70bc1f2cda9d898f0516d141 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 14 Jan 2022 16:37:50 +0100 Subject: [PATCH] ' & " crap --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index eb724f5..361a607 100644 --- a/main.py +++ b/main.py @@ -32,7 +32,7 @@ class Universite: # page des résultats intermédiaire try: - url = [element.attrs["href"] for element in reponse.html.find("a") if "id" in element.attrs if element.attrs["id"] == "service-407"][0] + url = [element.attrs["href"] for element in reponse.html.find('a') if "id" in element.attrs if element.attrs["id"] == "service-407"][0] except IndexError: # Arrive quand "An Error Has Occurred" raise TimeoutError("Le site a prit trop de temps pour répondre, veuillez réessayez plus tard.") reponse = session.get(url, allow_redirects = False) @@ -43,7 +43,8 @@ class Universite: url = f"{url}?{[element.attrs['action'] for element in reponse.html.find('form') if 'enctype' in element.attrs if element.attrs['enctype'] == 'application/x-www-form-urlencoded'][0].split('?')[1].replace('welcome', 'notes')}" reponse = session.get(url) anneesTemp = [element for element in reponse.html.find('a') if "href" in element.attrs if element.attrs["href"] == '#'][6:] - # on retire un item sur deux car : ['L2MINF/210', 'L2 Informatique', 'L1MINF/210', 'L1 Informatique'] il y a des doublons + + # on retire un item sur deux car : ['L2MINF/210', 'L2 Informatique', 'L1MINF/210', 'L1 Informatique'] -> il y a des doublons annees = [] for i in range(0, len(anneesTemp)): if i % 2: @@ -53,7 +54,7 @@ class Universite: resultat = {} for annee in annees: reponse = session.post(url) - script = annee.attrs['onclick'][7:] + script = annee.attrs["onclick"][7:] reponse.html.render(script=script) resultat[annee.text] = None