pronote direct integration

This commit is contained in:
√(noham)² 2024-03-24 18:17:17 +01:00
parent 926accf6c1
commit 2049613f25
3 changed files with 34 additions and 23 deletions

View File

@ -1,4 +1,6 @@
DISCORD_WEBHOOKS_PRONOTE = 'https://discord.com/api/webhooks/???' DISCORD_WEBHOOKS_PRONOTE = 'https://discord.com/api/webhooks/???'
ENT_USERNAME = 'prenom.nom' ENT_USERNAME = 'prenom.nom'
ENT_PASSWORD = 'mdp' ENT_PASSWORD = 'mdp'
PRNT_USERNAME = 'pnom'
PRNT_PASSWORD = 'mpd'
ENT = 'ile_de_france' ENT = 'ile_de_france'

View File

@ -15,34 +15,34 @@ Pour utiliser PronoteBot, suivez ces étapes :
1. Clonez le dépôt : 1. Clonez le dépôt :
```bash ```bash
git clone https://github.com/NohamR/PronoteBot.git git clone https://github.com/NohamR/PronoteBot.git
cd PronoteBot cd PronoteBot
``` ```
2. Installez les dépendances : 2. Installez les dépendances :
```bash ```bash
pip install -r requirements.txt pip install -r requirements.txt
``` ```
3. Configurez vos variables d'environnement en créant un fichier .env avec le contenu suivant : 3. Configurez vos variables d'environnement en créant un fichier .env avec le contenu suivant :
```bash ```bash
DISCORD_WEBHOOKS_PRONOTE=your_discord_webhook_url DISCORD_WEBHOOKS_PRONOTE=your_discord_webhook_url
ENT_USERNAME=your_ent_username ENT_USERNAME=your_ent_username
ENT_PASSWORD=your_ent_password ENT_PASSWORD=your_ent_password
ENT=name_of_ent 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. 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 PronoteBot : 4. Exécutez le script PronoteBot :
```bash ```bash
python3 getgrades.py python3 getgrades.py
``` ```
## Docker ## Docker
@ -55,11 +55,15 @@ Le fichier Dockerfile est disponible [ici](Dockerfile). Assurez-vous de le place
Pour construire l'image Docker, exécutez la commande suivante à la racine du répertoire PronoteBot : Pour construire l'image Docker, exécutez la commande suivante à la racine du répertoire PronoteBot :
docker build -t PronoteBot:latest . ```bash
docker run -d PronoteBot:latest docker build -t PronoteBot:latest .
docker run -d PronoteBot:latest
```
### docker-compose.yaml ### docker-compose.yaml
Le fichier docker-compose.yaml est disponible [ici](docker-compose.yaml). Assurez-vous de le placer à la racine du répertoire PronoteBot. Le fichier docker-compose.yaml est disponible [ici](docker-compose.yaml). Assurez-vous de le placer à la racine du répertoire PronoteBot.
docker-compose up -d ```bash
docker-compose up -d
```

View File

@ -11,6 +11,8 @@ 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")
PRNT_USERNAME = os.getenv("PRNT_USERNAME")
PRNT_PASSWORD = os.getenv("PRNT_PASSWORD")
ENT = os.getenv("ENT") ENT = os.getenv("ENT")
path = 'new/pronote/' path = 'new/pronote/'
path ='' path =''
@ -36,10 +38,13 @@ def envoyer_message_webhook(contenu):
def refresh(send): def refresh(send):
content = '' content = ''
try : try :
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=globals().get(ENT)) #ile_de_france # ent=globals().get(ENT)) #ile_de_france
client = pronotepy.Client('https://0910626l.index-education.net/pronote/eleve.html?login=true',
username=PRNT_USERNAME,
password=PRNT_PASSWORD)
if not client.logged_in: if not client.logged_in:
exit(1) exit(1)