From 9e7226db243a2c086eb89aa1fe3e93c8ebc224ca Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 12 Jan 2023 22:40:44 +0100 Subject: [PATCH] use requirements.txt for venv --- .gitignore | 4 ++++ README.md | 8 ++------ main.py | 33 +++++++++++++++++++++------------ requirements.txt | 2 ++ 4 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 902eded..83c9ce7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ .env *.html + +bin/ +lib/ +pyvenv.cfg diff --git a/README.md b/README.md index 998b250..d8c78a1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,7 @@ # Wrapper de notes pour [uPortal](https://github.com/uPortal-Project/uPortal-start) -## Pré-requis -``` -requests-html==0.10.0 -python-dotenv==0.19.2 -``` - ## Utilisation + ``` python3 main.py "" "" "" @@ -16,4 +11,5 @@ python3 main.py "" " il y a des doublons annees = [] @@ -56,9 +61,11 @@ class Universite: resultat[annee.text] = None reponse.html.render(script=annee.attrs["onclick"][7:]) - reponse = session.post(url.replace("render", "action").replace("detail", "")) + reponse = session.post(url.replace( + "render", "action").replace("detail", "")) - reponse = session.get(url.replace("action", "render").replace("notes", "detailnotes")) + reponse = session.get(url.replace( + "action", "render").replace("notes", "detailnotes")) self.ecrirePageHTML(annee.text, reponse.text) return resultat @@ -71,6 +78,7 @@ class Universite: """Affiche les notes dans stdout.""" print(self.affichageNotes(self.recuperationNotes())) + if __name__ == "__main__": nom = argv.pop(0) if len(argv) == 3: @@ -78,7 +86,8 @@ if __name__ == "__main__": else: load_dotenv() try: - Universite(environ["URL"], environ["LOGIN"], environ["PASSWORD"]).notes() + Universite(environ["URL"], environ["LOGIN"], + environ["PASSWORD"]).notes() except KeyError: raise Exception(f""" \nMerci de renseigner l'URL, le pseudo et le mot de passe (avec des \"). \ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..302183f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +requests-html==0.10.0 +python-dotenv==0.19.2