' & " crap
This commit is contained in:
parent
eeb369cb50
commit
7112858874
1 changed files with 4 additions and 3 deletions
7
main.py
7
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
|
||||
|
||||
|
|
Reference in a new issue