From 34b6b0cde12fdd2cd9dc1a8bbe4e459e0c588d31 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 14 Jan 2022 16:51:54 +0100 Subject: [PATCH] correction order get and post request --- main.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 361a607..94707a1 100644 --- a/main.py +++ b/main.py @@ -53,16 +53,13 @@ class Universite: # récupération notes resultat = {} for annee in annees: - reponse = session.post(url) - script = annee.attrs["onclick"][7:] - reponse.html.render(script=script) resultat[annee.text] = None - url = url.replace("notes", "detailnotes") - reponse = session.get(url) - url = url.replace("detailnotes", "notes") - self.ecrirePageHTML(annee.text, reponse.text) + reponse.html.render(script=annee.attrs["onclick"][7:]) + reponse = session.post(url.replace("render", "action").replace("detail", "")) + reponse = session.get(url.replace("action", "render").replace("notes", "detailnotes")) + self.ecrirePageHTML(annee.text, reponse.text) return resultat