Public Access
Test : Intégration bouton PayPal Sandbox et activation du Serveur Mail
Build and Push Docker Image / build-and-push (push) Successful in 1m45s
Build and Push Docker Image / build-and-push (push) Successful in 1m45s
This commit is contained in:
1 parent
632c23069a
commit
2ea18701b5
12 files changed
+486
-187
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import os
|
||||
import requests
|
||||
import xml.etree.ElementTree as ET
|
||||
from datetime import datetime
|
||||
from modules.logger import log_event
|
||||
|
||||
RAG_DIR = "/DATA/AppData/MULTI-IA-AETHAS38/RAG/Education_Nationale"
|
||||
|
||||
def maj_base_education():
|
||||
"""Scrape le flux RSS du Bulletin Officiel pour maintenir la base documentaire à jour."""
|
||||
os.makedirs(RAG_DIR, exist_ok=True)
|
||||
url_rss = "https://www.education.gouv.fr/bo/rss.xml"
|
||||
|
||||
try:
|
||||
response = requests.get(url_rss, timeout=15)
|
||||
if response.status_code == 200:
|
||||
root = ET.fromstring(response.content)
|
||||
|
||||
# Formatage pour une ingestion parfaite par le RAG
|
||||
contenu_md = f"# Veille Pédagogique - Bulletin Officiel (B.O.)\n"
|
||||
contenu_md += f"*Date de mise à jour RAG : {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*\n\n"
|
||||
|
||||
# On extrait les 20 dernières circulaires/textes de loi
|
||||
for item in root.findall('.//item')[:20]:
|
||||
titre = item.find('title').text if item.find('title') is not None else "Document sans titre"
|
||||
lien = item.find('link').text if item.find('link') is not None else "Aucun lien"
|
||||
desc = item.find('description').text if item.find('description') is not None else "Pas de résumé disponible."
|
||||
|
||||
contenu_md += f"## {titre}\n"
|
||||
contenu_md += f"**Source officielle :** {lien}\n"
|
||||
contenu_md += f"> {desc}\n\n---\n"
|
||||
|
||||
fichier_bo = os.path.join(RAG_DIR, "bulletin_officiel_recent.md")
|
||||
with open(fichier_bo, "w", encoding="utf-8") as f:
|
||||
f.write(contenu_md)
|
||||
|
||||
log_event("INFO", "SCRAPER_EDU", "Base RAG Éducation (B.O.) mise à jour avec succès.")
|
||||
else:
|
||||
log_event("WARNING", "SCRAPER_EDU", f"Le site du ministère a retourné le code {response.status_code}.")
|
||||
except Exception as e:
|
||||
log_event("ERROR", "SCRAPER_EDU", f"Erreur lors de la MAJ de la base Éducation : {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Permet de tester le script directement en ligne de commande : python modules/eduscol_scraper.py
|
||||
maj_base_education()
|
||||
Reference in new issue
Block a user