add README

This commit is contained in:
√(noham)² 2023-12-20 21:37:28 +01:00
parent 3ca9f33989
commit bf4852b012
2 changed files with 66 additions and 1 deletions

64
README.md Normal file
View File

@ -0,0 +1,64 @@
# PronoteApi
PronoteApi est un projet conçu pour faciliter la récupération des notes Pronote et envoyer des mises à jour à un webhook. Il utilise la bibliothèque [pronotepy](https://github.com/bain3/pronotepy) pour les interactions avec Pronote.
## Dépendances
- [pronotepy](https://github.com/bain3/pronotepy)
- python-dotenv (optionnel)
- requests
## Utilisation
Pour utiliser PronoteApi, suivez ces étapes :
1. Clonez le dépôt :
```bash
git clone https://github.com/NohamR/PronoteApi.git
cd PronoteApi
```
2. Installez les dépendances :
```bash
pip install -r requirements.txt
```
3. Configurez vos variables d'environnement en créant un fichier .env avec le contenu suivant :
```bash
DISCORD_WEBHOOKS_PRONOTE=your_discord_webhook_url
ENT_USERNAME=your_ent_username
ENT_PASSWORD=your_ent_password
ENT=name_of_ent
```
Pour avoir le nom de votre ent : [ici](https://pronotepy.readthedocs.io/en/stable/api/ent.html), par exemple : ile_de_france.
4. Exécutez le script PronoteApi :
```bash
python3 getgrades.py
```
## Docker
Vous pouvez également construire et exécuter PronoteApi en tant que conteneur Docker. Utilisez les configurations Dockerfile et docker-compose.yaml suivantes :
### Dockerfile
Le fichier Dockerfile est disponible [ici](Dockerfile). Assurez-vous de le placer à la racine du répertoire PronoteApi.
Pour construire l'image Docker, exécutez la commande suivante à la racine du répertoire PronoteApi :
docker build -t pronoteapi:latest .
docker run -d pronoteapi:latest
### docker-compose.yaml
Le fichier docker-compose.yaml est disponible [ici](docker-compose.yaml). Assurez-vous de le placer à la racine du répertoire PronoteApi.
docker-compose up -d

View File

@ -11,6 +11,7 @@ load_dotenv()
DISCORD_WEBHOOKS_PRONOTE = os.getenv("DISCORD_WEBHOOKS_PRONOTE") DISCORD_WEBHOOKS_PRONOTE = os.getenv("DISCORD_WEBHOOKS_PRONOTE")
ENT_USERNAME = os.getenv("ENT_USERNAME") ENT_USERNAME = os.getenv("ENT_USERNAME")
ENT_PASSWORD = os.getenv("ENT_PASSWORD") ENT_PASSWORD = os.getenv("ENT_PASSWORD")
ENT = os.getenv("ENT")
path = 'new/pronote/' path = 'new/pronote/'
path ='' path =''
@ -34,7 +35,7 @@ def refresh(send):
client = pronotepy.Client('https://0910626l.index-education.net/pronote/eleve.html', client = pronotepy.Client('https://0910626l.index-education.net/pronote/eleve.html',
username=ENT_USERNAME, username=ENT_USERNAME,
password=ENT_PASSWORD, password=ENT_PASSWORD,
ent=ile_de_france) ent=globals().get(ENT)) #ile_de_france
if not client.logged_in: if not client.logged_in:
exit(1) exit(1)