1604-9:59attacments

This commit is contained in:
Ladebeze66 2025-04-16 09:59:27 +02:00
parent 0274aeb8da
commit dc511fe222
43 changed files with 511 additions and 151 deletions

View File

@ -1,14 +0,0 @@
<div class="o_thread_message_content" style='font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'>
<p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'>
</p>
<div style='font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'>
<p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'><span style='font-size:11.0pt; font-family:"Calibri",sans-serif'>Bonjour,</span></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p>
<p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'><span style='font-size:11.0pt; font-family:"Calibri",sans-serif'></span></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'> </p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p>
<p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'><span style='font-size:11.0pt; font-family:"Calibri",sans-serif'>Je ne parviens pas à accéder au lessai au bleu :</span></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p>
<p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'><img height="337" id="Image_x0020_1" src="https://odoo.cbao.fr/web/image/145435?access_token=608ac9e7-3627-4a13-a8ec-06ff5046ebf3" style="border-style:none; vertical-align:middle; width:6.5in; height:3.5083in" width="624"/><span style='font-size:11.0pt; font-family:"Calibri",sans-serif'></span></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p>
<p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'><span style='font-size:11.0pt; font-family:"Calibri",sans-serif'></span></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'> </p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p>
<p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'><span style='font-size:11.0pt; font-family:"Calibri",sans-serif'>Merci par avance pour votre.</span></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p>
<p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'><span style='font-size:11.0pt; font-family:"Calibri",sans-serif'></span></p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'> </p><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'></p>
<p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'><span style='font-size:11.0pt; font-family:"Calibri",sans-serif'>Cordialement</span></p></div></div><p style='margin:0px 0 1rem 0; font-size:13px; font-family:"Lucida Grande", Helvetica, Verdana, Arial, sans-serif'><br/></p>

View File

@ -1,7 +0,0 @@
Bonjour,
Je ne parviens pas à accéder au lessai au bleu :
Merci par avance pour votre.
Cordialement

View File

@ -3,10 +3,11 @@ import base64
import logging
import requests
import re
import json
import datetime
from typing import List, Dict, Any, Optional, Set
from .auth_manager import AuthManager
from core.utils import save_json, normalize_filename
from utils.image_extractor.html_image_extractor import extract_images_from_ticket
class AttachmentManager:
"""
@ -125,7 +126,7 @@ class AttachmentManager:
result["error"] = str(e)
return result
def download_image_from_url(self, url: str, output_dir: str, filename: str = None) -> Dict[str, Any]:
def download_image_from_url(self, url: str, output_dir: str, filename: Optional[str] = None) -> Dict[str, Any]:
"""
Télécharge une image à partir d'une URL et la sauvegarde dans le répertoire des pièces jointes.
@ -145,18 +146,37 @@ class AttachmentManager:
}
try:
# Extraire l'ID de l'image et le token d'accès si présents
img_id = None
access_token = None
# Pattern pour /web/image/ID?access_token=...
id_match = re.search(r"/web/image/(\d+)", url)
if id_match:
img_id = int(id_match.group(1))
# Extraire le token d'accès
token_match = re.search(r"access_token=([^&]+)", url)
if token_match:
access_token = token_match.group(1)
# Extraire le nom de fichier de l'URL si non fourni
if not filename:
# Extraire le nom de fichier de l'URL
url_path = url.split('?')[0] # Supprimer les paramètres de requête
path_parts = url_path.split('/')
filename = path_parts[-1] if path_parts else f"image_{hash(url)}.jpg"
if img_id:
# Utiliser l'ID de l'image
filename = f"image_{img_id}.png"
else:
# Extraire le nom de fichier de l'URL
url_path = url.split('?')[0] # Supprimer les paramètres de requête
path_parts = url_path.split('/')
filename = path_parts[-1] if path_parts else f"image_{hash(url)}.jpg"
# Créer le dossier attachments s'il n'existe pas
attachments_dir = os.path.join(output_dir, "attachments")
os.makedirs(attachments_dir, exist_ok=True)
# Construire un nom de fichier sécurisé
if filename is None:
filename = f"image_{hash(url)}.jpg"
safe_filename = normalize_filename(filename)
file_path = os.path.join(attachments_dir, safe_filename)
@ -170,7 +190,12 @@ class AttachmentManager:
counter += 1
# Télécharger l'image en utilisant la session authentifiée
response = requests.get(url, cookies=self.auth.cookies, headers=self.auth.headers, verify=self.auth.verify_ssl)
# Vérifier les attributs disponibles dans l'objet auth
cookies = getattr(self.auth, 'cookies', None)
headers = getattr(self.auth, 'headers', None)
verify_ssl = getattr(self.auth, 'verify_ssl', True)
response = requests.get(url, cookies=cookies, headers=headers, verify=verify_ssl)
response.raise_for_status()
# Sauvegarder l'image
@ -187,13 +212,16 @@ class AttachmentManager:
'.svg': 'image/svg+xml'
}.get(ext.lower(), 'application/octet-stream')
result.update({
"status": "success",
"file_path": file_path,
"mimetype": mimetype,
"file_size": len(response.content),
"name": os.path.basename(file_path)
})
# Mettre à jour le résultat avec les informations du fichier
result["status"] = "success"
result["file_path"] = file_path
result["mimetype"] = mimetype
result["file_size"] = str(len(response.content))
result["name"] = os.path.basename(file_path)
if img_id is not None:
result["id"] = str(img_id)
if access_token:
result["access_token"] = access_token
return result
@ -215,23 +243,68 @@ class AttachmentManager:
"""
extracted_images = []
# Utiliser l'extracteur d'images HTML pour trouver les images intégrées
try:
# Vérifier si l'extracteur d'images est disponible
image_paths = extract_images_from_ticket(output_dir)
logging.info(f"Images trouvées par l'extracteur HTML: {len(image_paths)}")
# Chercher aussi les URL d'images dans les messages
# Chercher les URL d'images dans les messages
image_urls = self._extract_image_urls_from_messages(messages_data)
logging.info(f"URLs d'images trouvées dans les messages: {len(image_urls)}")
# Récupérer les IDs des pièces jointes existantes pour éviter les doublons
existing_attachments = {}
attachments_info_path = os.path.join(output_dir, "attachments_info.json")
if os.path.exists(attachments_info_path):
try:
with open(attachments_info_path, 'r', encoding='utf-8') as f:
existing_attachments_info = json.load(f)
for att in existing_attachments_info:
if "id" in att and att["id"]:
existing_attachments[str(att["id"])] = att
except Exception as e:
logging.error(f"Erreur lors du chargement des pièces jointes existantes: {e}")
# Télécharger les images depuis les URLs
for url in image_urls:
# Vérifier si l'image a déjà un ID extrait de l'URL
img_id = None
id_match = re.search(r"/web/image/(\d+)", url)
if id_match:
img_id = id_match.group(1)
# Vérifier si cette image existe déjà
if img_id in existing_attachments:
logging.info(f"Image avec ID {img_id} déjà présente dans les pièces jointes, ignorée")
continue
# Télécharger l'image
result = self.download_image_from_url(url, output_dir)
if result["status"] == "success":
# Ajouter des informations sur la source
result["source"] = "message_embedded"
result["extraction_date"] = datetime.datetime.now().isoformat()
# Traiter le message source si disponible
message_id = None
message_author = None
messages = messages_data.get("messages", [])
for msg in messages:
body = msg.get("body_original", msg.get("body", ""))
if body and url in body:
message_id = msg.get("id")
if "author_id" in msg and isinstance(msg["author_id"], list) and len(msg["author_id"]) >= 2:
message_author = msg["author_id"][1]
elif "author_id" in msg and isinstance(msg["author_id"], int):
message_author = f"User ID: {msg['author_id']}"
break
if message_id:
result["source_message_id"] = message_id
if message_author:
result["message_author"] = message_author
extracted_images.append(result)
logging.info(f"Image téléchargée depuis l'URL: {url}")
logging.info(f"Total des images extraites: {len(extracted_images)}")
except Exception as e:
logging.error(f"Erreur lors de l'extraction des images manquantes: {e}")
@ -250,7 +323,7 @@ class AttachmentManager:
image_urls = set()
# Récupérer la liste des messages
messages = messages_data.get("messages", [])
messages = messages_data.get("messages", []) if messages_data else []
if not messages:
return image_urls
@ -262,14 +335,32 @@ class AttachmentManager:
continue
# Recherche des URLs d'images dans le HTML
# 1. Images Odoo internes avec /web/image/ ou /web/content/
# 1. Trouver toutes les balises <img> avec leur src complet
img_tags = re.finditer(r'<img[^>]+src=["\']([^"\']+)["\'][^>]*>', body)
for match in img_tags:
img_url = match.group(1)
# Ignorer les URLs data:
if img_url.startswith('data:'):
continue
# Ajouter le domaine Odoo si l'URL est relative
if img_url.startswith('/web/'):
base_url = ""
if hasattr(self.auth, 'url') and self.auth.url:
base_url = self.auth.url.split('/xmlrpc')[0] # Extraire le domaine de base
img_url = f"{base_url}{img_url if img_url.startswith('/') else '/' + img_url}"
image_urls.add(img_url)
# 2. Images Odoo internes avec /web/image/ ou /web/content/
odoo_image_urls = re.findall(r'src=["\']((https?://[^"\']+)?/web/(image|content)/[^"\']+)["\']', body)
for match in odoo_image_urls:
url = match[0]
# Ajouter le domaine Odoo si l'URL est relative
if not url.startswith(('http://', 'https://')):
# Utiliser le domaine de base de l'API Odoo
if self.auth.url:
base_url = ""
if hasattr(self.auth, 'url') and self.auth.url:
base_url = self.auth.url.split('/xmlrpc')[0] # Extraire le domaine de base
url = f"{base_url}{url if url.startswith('/') else '/' + url}"
@ -277,7 +368,7 @@ class AttachmentManager:
if url and not url.startswith('data:'):
image_urls.add(url)
# 2. Images externes
# 3. Images externes
external_image_urls = re.findall(r'src=["\']((https?://[^"\']+)\.(jpe?g|png|gif|svg)([^"\']*)?)["\']', body)
for match in external_image_urls:
url = match[0]
@ -286,7 +377,7 @@ class AttachmentManager:
return image_urls
def save_attachments(self, ticket_id: int, output_dir: str, download: bool = True, messages_data: Dict[str, Any] = None) -> List[Dict[str, Any]]:
def save_attachments(self, ticket_id: int, output_dir: str, download: bool = True, messages_data: Optional[Dict[str, Any]] = None) -> List[Dict[str, Any]]:
"""
Récupère et sauvegarde toutes les pièces jointes d'un ticket.
@ -349,18 +440,29 @@ class AttachmentManager:
# Ajouter les images extraites à la liste des pièces jointes
for image in missing_images:
# Convertir l'ID en chaîne si c'est un entier
image_id = image.get("id")
if image_id is not None and isinstance(image_id, int):
image_id = str(image_id)
else:
image_id = f"embedded_{len(attachments_info) + 1}"
image_info = {
"id": f"embedded_{len(attachments_info) + 1}", # Identifiant unique pour l'image intégrée
"id": image_id,
"name": image.get("name", "Sans nom"),
"mimetype": image.get("mimetype", "image/jpeg"),
"file_size": image.get("file_size", 0),
"file_size": str(image.get("file_size", 0)),
"create_date": None,
"creator_name": "Extraction automatique",
"download_status": image.get("status"),
"local_path": image.get("file_path", ""),
"error": image.get("error", ""),
"is_embedded_image": True,
"source_url": image.get("url", "")
"source_url": image.get("url", ""),
"source": image.get("source", ""),
"extraction_date": image.get("extraction_date", ""),
"source_message_id": image.get("source_message_id", ""),
"message_author": image.get("message_author", "")
}
attachments_info.append(image_info)

View File

@ -163,7 +163,19 @@ class TicketManager:
)
# Récupérer et sauvegarder les pièces jointes
attachments_info = self.attachment_manager.save_attachments(ticket_id, output_dir)
# Récupérer les données des messages pour extraire les images intégrées
messages_data = None
all_messages_path = messages_result.get("all_messages_path")
if all_messages_path and os.path.exists(all_messages_path):
try:
with open(all_messages_path, 'r', encoding='utf-8') as f:
messages_data = json.load(f)
logging.info("Données des messages chargées pour l'extraction des images intégrées")
except Exception as e:
logging.error(f"Erreur lors du chargement des données des messages: {e}")
# Appeler save_attachments avec les données des messages
attachments_info = self.attachment_manager.save_attachments(ticket_id, output_dir, download=True, messages_data=messages_data)
attachments_info_path = os.path.join(output_dir, "attachments_info.json")
# Récupérer les followers si disponibles

View File

@ -1,20 +0,0 @@
[
{
"id": 145453,
"name": "image.png",
"mimetype": "image/png",
"file_size": 76543,
"create_date": "2025-04-03 12:17:41",
"create_uid": [
22,
"Fabien LAFAY"
],
"description": false,
"res_name": "[T11143] BRGLAB - Essai inaccessible",
"creator_name": "Fabien LAFAY",
"creator_id": 22,
"download_status": "success",
"local_path": "output/ticket_T11143/T11143_20250416_093439/attachments/image.png",
"error": ""
}
]

View File

@ -36,6 +36,6 @@
"content": "Bonjour,\nLe problème sest résolu seul par la suite.\nJe vous remercie pour votre retour.\nBonne journée\nPS : ladresse fonctionne\nDe :\n\n---\n"
}
],
"date_d'extraction": "16/04/2025 09:34:39",
"répertoire": "output/ticket_T11143/T11143_20250416_093439"
"date_d'extraction": "16/04/2025 09:56:04",
"répertoire": "output/ticket_T11143/T11143_20250416_095603"
}

View File

@ -89,5 +89,5 @@ De :
## Informations sur l'extraction
- **Date d'extraction**: 16/04/2025 09:34:39
- **Répertoire**: output/ticket_T11143/T11143_20250416_093439
- **Date d'extraction**: 16/04/2025 09:56:04
- **Répertoire**: output/ticket_T11143/T11143_20250416_095603

View File

@ -7,7 +7,7 @@
"project_name": "Demandes",
"stage_id": 8,
"stage_name": "Clôturé",
"date_extraction": "2025-04-16T09:34:39.776257"
"date_extraction": "2025-04-16T09:56:04.187129"
},
"metadata": {
"message_count": {

View File

@ -1,5 +1,5 @@
TICKET: T11143 - BRGLAB - Essai inaccessible
Date d'extraction: 2025-04-16 09:34:39
Date d'extraction: 2025-04-16 09:56:04
Nombre de messages: 7
================================================================================

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -0,0 +1,122 @@
[
{
"id": 145453,
"name": "image.png",
"mimetype": "image/png",
"file_size": 76543,
"create_date": "2025-04-03 12:17:41",
"create_uid": [
22,
"Fabien LAFAY"
],
"description": false,
"res_name": "[T11143] BRGLAB - Essai inaccessible",
"creator_name": "Fabien LAFAY",
"creator_id": 22,
"download_status": "success",
"local_path": "output/ticket_T11143/T11143_20250416_095603/attachments/image.png",
"error": ""
},
{
"id": "embedded_2",
"name": "5ad281b63492e31c9e66bf27518b816cdd3766cab9812bd4ff16b736e9e98265.jpg",
"mimetype": "image/jpeg",
"file_size": "36638",
"create_date": null,
"creator_name": "Extraction automatique",
"download_status": "success",
"local_path": "output/ticket_T11143/T11143_20250416_095603/attachments/5ad281b63492e31c9e66bf27518b816cdd3766cab9812bd4ff16b736e9e98265.jpg",
"error": "",
"is_embedded_image": true,
"source_url": "https://img.mail.cbao.fr/im/2881244/5ad281b63492e31c9e66bf27518b816cdd3766cab9812bd4ff16b736e9e98265.jpg?e=8r2BeeTx41o7P48QGc8dTA9QZOB2GTlwPmvmUKM1mOEj7PIixgxi8THfMHUzkbxvWZ0IeDNk2GLdKrFDTFmFNUwsuze9m9iIGLsevTWvi9J0FKdCiHPM_N7oHl28BaOgXNM5hJnnQQiBDTuFH9yOdwtANlSU-In61mRTQcU059dPwIa6d7cW4mYPKAM316uk4wF5BzQTalI2490N3xfQO-NGNQq2w2JAiGOTUvWOI05ZCSyZ-qmoLbTFg6P9dUskVN6qx6F1PpKND8esvfmxiTdAIV1_tvg6owg8U_MCtUp8laoDr4Si8qIIDu02_ZtzEOxPW9rG0WCFcwx3",
"source": "message_embedded",
"extraction_date": "2025-04-16T09:56:04.396379",
"source_message_id": 228971,
"message_author": "GIRAUD TP (JCG), Victor BOLLÉE"
},
{
"id": "embedded_3",
"name": "5JbLgq7JMCd0cW4WUA-lgvTWXWdoLO1_ucWlr1Lq-Aahl3ciesDgM6O8PTgP7DJSRVCBx5lLZeGCOG9eZyn5F6PdDURFrtnzk...",
"mimetype": "application/octet-stream",
"file_size": "43",
"create_date": null,
"creator_name": "Extraction automatique",
"download_status": "success",
"local_path": "output/ticket_T11143/T11143_20250416_095603/attachments/5JbLgq7JMCd0cW4WUA-lgvTWXWdoLO1_ucWlr1Lq-Aahl3ciesDgM6O8PTgP7DJSRVCBx5lLZeGCOG9eZyn5F6PdDURFrtnzk...",
"error": "",
"is_embedded_image": true,
"source_url": "http://r.mail.cbao.fr/tr/op/5JbLgq7JMCd0cW4WUA-lgvTWXWdoLO1_ucWlr1Lq-Aahl3ciesDgM6O8PTgP7DJSRVCBx5lLZeGCOG9eZyn5F6PdDURFrtnzkWtHz8COpP16VAIdOWIpK8w_elOaV8Zi2U1ZjvCAMpCqfCYJYDADVxV2xRjq3plCjFMQ-FWOfmWoDIFWxksfoc2I5mhhnsrw",
"source": "message_embedded",
"extraction_date": "2025-04-16T09:56:04.493782",
"source_message_id": 228971,
"message_author": "GIRAUD TP (JCG), Victor BOLLÉE"
},
{
"id": "embedded_4",
"name": "image_145453.png",
"mimetype": "image/png",
"file_size": "76543",
"create_date": null,
"creator_name": "Extraction automatique",
"download_status": "success",
"local_path": "output/ticket_T11143/T11143_20250416_095603/attachments/image_145453.png",
"error": "",
"is_embedded_image": true,
"source_url": "https://odoo.cbao.fr/web/image/145453?access_token=9c5d3a29-fce3-411f-8973-e3f33aa8f32c",
"source": "message_embedded",
"extraction_date": "2025-04-16T09:56:04.635773",
"source_message_id": "",
"message_author": ""
},
{
"id": "embedded_5",
"name": "543d7da1b54c29ff43ce5712d1a9aa4962ed21795c4e943fcb8cb84fd4d7465a.jpg",
"mimetype": "image/jpeg",
"file_size": "10192",
"create_date": null,
"creator_name": "Extraction automatique",
"download_status": "success",
"local_path": "output/ticket_T11143/T11143_20250416_095603/attachments/543d7da1b54c29ff43ce5712d1a9aa4962ed21795c4e943fcb8cb84fd4d7465a.jpg",
"error": "",
"is_embedded_image": true,
"source_url": "https://img.mail.cbao.fr/im/2881244/543d7da1b54c29ff43ce5712d1a9aa4962ed21795c4e943fcb8cb84fd4d7465a.jpg?e=kEDXgN0xHfEb-981h_lc_yULm91O7bZKL_LYGfrT2K86Ta7cu921uClZUdgMhvotDWlcCzD3lJtBuoEhqI1Gywup4qaf3_WKJ6oubZu7p_5Stx-yi0SEGpWmdZd7tnRqk39JBwZTv6QvJDmP-3-8a_GVN6XIVj2mk65O7ASevFoYG54BN1Bzy0CebDYuMGOLCZGigDc_ZfReFYMsdxNdUnxNy9uoEFa9wO6djoxvs6pAQkJdPyaJMbf-vC-scsOjG4mbDhUUNKk",
"source": "message_embedded",
"extraction_date": "2025-04-16T09:56:04.721509",
"source_message_id": 228971,
"message_author": "GIRAUD TP (JCG), Victor BOLLÉE"
},
{
"id": "embedded_6",
"name": "a20f7697fd5e1d1fca3296c6d01228220e0e112c46b4440cc938f74d10934e98.gif",
"mimetype": "image/gif",
"file_size": "43",
"create_date": null,
"creator_name": "Extraction automatique",
"download_status": "success",
"local_path": "output/ticket_T11143/T11143_20250416_095603/attachments/a20f7697fd5e1d1fca3296c6d01228220e0e112c46b4440cc938f74d10934e98.gif",
"error": "",
"is_embedded_image": true,
"source_url": "https://img.mail.cbao.fr/im/2881244/a20f7697fd5e1d1fca3296c6d01228220e0e112c46b4440cc938f74d10934e98.gif?e=J3oCbkWCHi7Jby6t0tMcS8mUioUDEMsJYthetssCVJI9F79WEhd03wXCmZ-MpVe_3kKAdx_UKcZh7LDpl4Os8alPD1hBRHXiL-2qkQEj4lUqUFcIVU3DjuHacMF2VQ1IaigOvBjMSkWrj63_l83dijq9mRqTXSs49fj4n3V7dQhw4xsQKlsroCMU2-_4smR8gNanwzu5M8xZrnbT6s3ze-l71gRqWBrO_iZDm8k3tZTQiEd0IHK_ydL2M7nO2Yqs1hKQsm0BdJW0RoUsbN51VgDXaWpY-XAoBAsEzhDdTyZcNdbwIaGtdhY9TXI72Egw6rdZ69UNJpQ4HuFZOJNYcFm6uCA0LxwFmx5n7nnYcYyY",
"source": "message_embedded",
"extraction_date": "2025-04-16T09:56:04.803732",
"source_message_id": 228971,
"message_author": "GIRAUD TP (JCG), Victor BOLLÉE"
},
{
"id": "embedded_7",
"name": "image_145435.png",
"mimetype": "image/png",
"file_size": "25267",
"create_date": null,
"creator_name": "Extraction automatique",
"download_status": "success",
"local_path": "output/ticket_T11143/T11143_20250416_095603/attachments/image_145435.png",
"error": "",
"is_embedded_image": true,
"source_url": "https://odoo.cbao.fr/web/image/145435?access_token=608ac9e7-3627-4a13-a8ec-06ff5046ebf3",
"source": "message_embedded",
"extraction_date": "2025-04-16T09:56:04.916710",
"source_message_id": 228942,
"message_author": "Fabien LAFAY"
}
]

View File

@ -1,9 +1,9 @@
{
"timestamp": "20250416_093439",
"timestamp": "20250416_095603",
"ticket_code": "T11143",
"output_directory": "output/ticket_T11143/T11143_20250416_093439",
"output_directory": "output/ticket_T11143/T11143_20250416_095603",
"message_count": 7,
"attachment_count": 1,
"attachment_count": 7,
"files_created": [
"ticket_info.json",
"ticket_summary.json",

View File

@ -1,9 +1,9 @@
{
"date_extraction": "2025-04-16T09:34:39.880507",
"date_extraction": "2025-04-16T09:56:04.949972",
"ticket_id": 11122,
"ticket_code": "T11143",
"ticket_name": "BRGLAB - Essai inaccessible",
"output_dir": "output/ticket_T11143/T11143_20250416_093439",
"output_dir": "output/ticket_T11143/T11143_20250416_095603",
"files": {
"ticket_info": "ticket_info.json",
"ticket_summary": "ticket_summary.json",
@ -15,6 +15,6 @@
},
"stats": {
"messages_count": 7,
"attachments_count": 1
"attachments_count": 7
}
}

View File

@ -1,56 +0,0 @@
[
{
"id": 129046,
"name": "image.png",
"mimetype": "image/png",
"file_size": 44511,
"create_date": "2024-07-04 13:03:58",
"create_uid": [
22,
"Fabien LAFAY"
],
"description": false,
"res_name": "[T9656] Gestion des utilisateurs",
"creator_name": "Fabien LAFAY",
"creator_id": 22,
"download_status": "success",
"local_path": "output/ticket_T9656/T9656_20250416_093517/attachments/image.png",
"error": ""
},
{
"id": 129044,
"name": "image.png",
"mimetype": "image/png",
"file_size": 25583,
"create_date": "2024-07-04 13:03:58",
"create_uid": [
22,
"Fabien LAFAY"
],
"description": false,
"res_name": "[T9656] Gestion des utilisateurs",
"creator_name": "Fabien LAFAY",
"creator_id": 22,
"download_status": "success",
"local_path": "output/ticket_T9656/T9656_20250416_093517/attachments/image_1.png",
"error": ""
},
{
"id": 129042,
"name": "image.png",
"mimetype": "image/png",
"file_size": 46468,
"create_date": "2024-07-04 13:03:58",
"create_uid": [
22,
"Fabien LAFAY"
],
"description": false,
"res_name": "[T9656] Gestion des utilisateurs",
"creator_name": "Fabien LAFAY",
"creator_id": 22,
"download_status": "success",
"local_path": "output/ticket_T9656/T9656_20250416_093517/attachments/image_2.png",
"error": ""
}
]

View File

@ -20,6 +20,6 @@
"content": "Bonjour,\nSi un utilisateur n'apparait pas dans la liste, c'est probablement car il n'a pas de laboratoire principal d'assigné.\nDans ce cas, il faut cocher la case \"Affiche les laboratoires secondaires\" pour le voir.\nVous pouvez ensuite retrouver l'utilisateur dans la liste (en utilisant les filtre sur les colonnes si besoin) et l'éditer.\nSur la fiche de l'utilisateur, vérifier si le laboratoire principal est présent, et ajoutez-le si ce n'est pas le cas.\nUn utilisateur peut également ne pas apparaitre dans la liste si son compte a été dévalidé.\nDans ce cas cochez la case \"Affiche les utilisateurs non valides\" pour le voir apparaitre dans la liste (en grisé).\nVous pouvez le rendre à nouveau valide en éditant son compte et en cochant la case \"Utilisateur valide\"\nJe reste à votre entière disposition pour toute information complémentaire.\nCordialement,\nPour vous accompagner au mieux, veuillez trouver ci-joint des liens d'aide :\nManuel d'utilisation :\nlien vers le manuel d'utilisation\n\n- image.png (image/png) [ID: 129046]\n- image.png (image/png) [ID: 129044]\n- image.png (image/png) [ID: 129042]\n\n---\n"
}
],
"date_d'extraction": "16/04/2025 09:35:18",
"répertoire": "output/ticket_T9656/T9656_20250416_093517"
"date_d'extraction": "16/04/2025 09:58:00",
"répertoire": "output/ticket_T9656/T9656_20250416_095759"
}

View File

@ -55,5 +55,5 @@ lien vers le manuel d'utilisation
## Informations sur l'extraction
- **Date d'extraction**: 16/04/2025 09:35:18
- **Répertoire**: output/ticket_T9656/T9656_20250416_093517
- **Date d'extraction**: 16/04/2025 09:58:00
- **Répertoire**: output/ticket_T9656/T9656_20250416_095759

View File

@ -7,7 +7,7 @@
"project_name": "Demandes",
"stage_id": 8,
"stage_name": "Clôturé",
"date_extraction": "2025-04-16T09:35:18.539902"
"date_extraction": "2025-04-16T09:58:00.276036"
},
"metadata": {
"message_count": {

View File

@ -1,5 +1,5 @@
TICKET: T9656 - Gestion des utilisateurs
Date d'extraction: 2025-04-16 09:35:18
Date d'extraction: 2025-04-16 09:58:00
Nombre de messages: 5
================================================================================

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -0,0 +1,107 @@
[
{
"id": 129046,
"name": "image.png",
"mimetype": "image/png",
"file_size": 44511,
"create_date": "2024-07-04 13:03:58",
"create_uid": [
22,
"Fabien LAFAY"
],
"description": false,
"res_name": "[T9656] Gestion des utilisateurs",
"creator_name": "Fabien LAFAY",
"creator_id": 22,
"download_status": "success",
"local_path": "output/ticket_T9656/T9656_20250416_095759/attachments/image.png",
"error": ""
},
{
"id": 129044,
"name": "image.png",
"mimetype": "image/png",
"file_size": 25583,
"create_date": "2024-07-04 13:03:58",
"create_uid": [
22,
"Fabien LAFAY"
],
"description": false,
"res_name": "[T9656] Gestion des utilisateurs",
"creator_name": "Fabien LAFAY",
"creator_id": 22,
"download_status": "success",
"local_path": "output/ticket_T9656/T9656_20250416_095759/attachments/image_1.png",
"error": ""
},
{
"id": 129042,
"name": "image.png",
"mimetype": "image/png",
"file_size": 46468,
"create_date": "2024-07-04 13:03:58",
"create_uid": [
22,
"Fabien LAFAY"
],
"description": false,
"res_name": "[T9656] Gestion des utilisateurs",
"creator_name": "Fabien LAFAY",
"creator_id": 22,
"download_status": "success",
"local_path": "output/ticket_T9656/T9656_20250416_095759/attachments/image_2.png",
"error": ""
},
{
"id": "embedded_4",
"name": "image_129042.png",
"mimetype": "image/png",
"file_size": "46468",
"create_date": null,
"creator_name": "Extraction automatique",
"download_status": "success",
"local_path": "output/ticket_T9656/T9656_20250416_095759/attachments/image_129042.png",
"error": "",
"is_embedded_image": true,
"source_url": "https://odoo.cbao.fr/web/image/129042?access_token=c60b2fac-c957-4a99-8f20-15154f71ede0",
"source": "message_embedded",
"extraction_date": "2025-04-16T09:58:00.484846",
"source_message_id": "",
"message_author": ""
},
{
"id": "embedded_5",
"name": "image_129046.png",
"mimetype": "image/png",
"file_size": "44511",
"create_date": null,
"creator_name": "Extraction automatique",
"download_status": "success",
"local_path": "output/ticket_T9656/T9656_20250416_095759/attachments/image_129046.png",
"error": "",
"is_embedded_image": true,
"source_url": "https://odoo.cbao.fr/web/image/129046?access_token=5056bf0f-a8a9-451e-beaa-359cd3fad7f9",
"source": "message_embedded",
"extraction_date": "2025-04-16T09:58:00.611627",
"source_message_id": "",
"message_author": ""
},
{
"id": "embedded_6",
"name": "image_129044.png",
"mimetype": "image/png",
"file_size": "25583",
"create_date": null,
"creator_name": "Extraction automatique",
"download_status": "success",
"local_path": "output/ticket_T9656/T9656_20250416_095759/attachments/image_129044.png",
"error": "",
"is_embedded_image": true,
"source_url": "https://odoo.cbao.fr/web/image/129044?access_token=f8a0cbb8-a3c1-4fa8-bd08-ed2674ae9f2f",
"source": "message_embedded",
"extraction_date": "2025-04-16T09:58:00.729989",
"source_message_id": "",
"message_author": ""
}
]

View File

@ -1,9 +1,9 @@
{
"timestamp": "20250416_093517",
"timestamp": "20250416_095759",
"ticket_code": "T9656",
"output_directory": "output/ticket_T9656/T9656_20250416_093517",
"output_directory": "output/ticket_T9656/T9656_20250416_095759",
"message_count": 5,
"attachment_count": 3,
"attachment_count": 6,
"files_created": [
"ticket_info.json",
"ticket_summary.json",

View File

@ -1,9 +1,9 @@
{
"date_extraction": "2025-04-16T09:35:18.659900",
"date_extraction": "2025-04-16T09:58:00.764088",
"ticket_id": 9635,
"ticket_code": "T9656",
"ticket_name": "Gestion des utilisateurs",
"output_dir": "output/ticket_T9656/T9656_20250416_093517",
"output_dir": "output/ticket_T9656/T9656_20250416_095759",
"files": {
"ticket_info": "ticket_info.json",
"ticket_summary": "ticket_summary.json",
@ -15,6 +15,6 @@
},
"stats": {
"messages_count": 5,
"attachments_count": 3
"attachments_count": 6
}
}

View File

@ -230,3 +230,83 @@
2025-04-16 09:35:18 - root - INFO - Messages traités: 5
2025-04-16 09:35:18 - root - INFO - Pièces jointes: 3
2025-04-16 09:35:18 - root - INFO - ------------------------------------------------------------
2025-04-16 09:45:12 - root - INFO - Extraction du ticket T11143
2025-04-16 09:45:12 - root - INFO - ------------------------------------------------------------
2025-04-16 09:45:13 - root - INFO - Traitement de 1 pièces jointes pour le ticket 11122
2025-04-16 09:45:13 - root - INFO - Pièce jointe téléchargée: image.png (1/1)
2025-04-16 09:45:13 - root - INFO - ------------------------------------------------------------
2025-04-16 09:45:13 - root - INFO - Extraction terminée avec succès
2025-04-16 09:45:13 - root - INFO - Ticket: T11143
2025-04-16 09:45:13 - root - INFO - Répertoire: output/ticket_T11143/T11143_20250416_094512
2025-04-16 09:45:13 - root - INFO - Messages traités: 7
2025-04-16 09:45:13 - root - INFO - Pièces jointes: 1
2025-04-16 09:45:13 - root - INFO - ------------------------------------------------------------
2025-04-16 09:49:58 - root - INFO - Extraction du ticket T11143
2025-04-16 09:49:58 - root - INFO - ------------------------------------------------------------
2025-04-16 09:49:59 - root - INFO - Traitement de 1 pièces jointes pour le ticket 11122
2025-04-16 09:49:59 - root - INFO - Pièce jointe téléchargée: image.png (1/1)
2025-04-16 09:49:59 - root - INFO - ------------------------------------------------------------
2025-04-16 09:49:59 - root - INFO - Extraction terminée avec succès
2025-04-16 09:49:59 - root - INFO - Ticket: T11143
2025-04-16 09:49:59 - root - INFO - Répertoire: output/ticket_T11143/T11143_20250416_094958
2025-04-16 09:49:59 - root - INFO - Messages traités: 7
2025-04-16 09:49:59 - root - INFO - Pièces jointes: 1
2025-04-16 09:49:59 - root - INFO - ------------------------------------------------------------
2025-04-16 09:52:15 - root - INFO - Extraction du ticket T11143
2025-04-16 09:52:15 - root - INFO - ------------------------------------------------------------
2025-04-16 09:52:16 - root - INFO - Traitement de 1 pièces jointes pour le ticket 11122
2025-04-16 09:52:16 - root - INFO - Pièce jointe téléchargée: image.png (1/1)
2025-04-16 09:52:16 - root - INFO - ------------------------------------------------------------
2025-04-16 09:52:16 - root - INFO - Extraction terminée avec succès
2025-04-16 09:52:16 - root - INFO - Ticket: T11143
2025-04-16 09:52:16 - root - INFO - Répertoire: output/ticket_T11143/T11143_20250416_095215
2025-04-16 09:52:16 - root - INFO - Messages traités: 7
2025-04-16 09:52:16 - root - INFO - Pièces jointes: 1
2025-04-16 09:52:16 - root - INFO - ------------------------------------------------------------
2025-04-16 09:56:03 - root - INFO - Extraction du ticket T11143
2025-04-16 09:56:03 - root - INFO - ------------------------------------------------------------
2025-04-16 09:56:04 - root - INFO - Données des messages chargées pour l'extraction des images intégrées
2025-04-16 09:56:04 - root - INFO - Traitement de 1 pièces jointes pour le ticket 11122
2025-04-16 09:56:04 - root - INFO - Pièce jointe téléchargée: image.png (1/1)
2025-04-16 09:56:04 - root - INFO - Extraction des images intégrées aux messages...
2025-04-16 09:56:04 - root - INFO - URLs d'images trouvées dans les messages: 10
2025-04-16 09:56:04 - root - INFO - Image téléchargée depuis l'URL: https://img.mail.cbao.fr/im/2881244/5ad281b63492e31c9e66bf27518b816cdd3766cab9812bd4ff16b736e9e98265.jpg?e=8r2BeeTx41o7P48QGc8dTA9QZOB2GTlwPmvmUKM1mOEj7PIixgxi8THfMHUzkbxvWZ0IeDNk2GLdKrFDTFmFNUwsuze9m9iIGLsevTWvi9J0FKdCiHPM_N7oHl28BaOgXNM5hJnnQQiBDTuFH9yOdwtANlSU-In61mRTQcU059dPwIa6d7cW4mYPKAM316uk4wF5BzQTalI2490N3xfQO-NGNQq2w2JAiGOTUvWOI05ZCSyZ-qmoLbTFg6P9dUskVN6qx6F1PpKND8esvfmxiTdAIV1_tvg6owg8U_MCtUp8laoDr4Si8qIIDu02_ZtzEOxPW9rG0WCFcwx3
2025-04-16 09:56:04 - root - ERROR - Erreur lors du téléchargement de l'image depuis /web_editor/font_to_img/61534/rgb(144,144,144)/13: Invalid URL '/web_editor/font_to_img/61534/rgb(144,144,144)/13': No scheme supplied. Perhaps you meant https:///web_editor/font_to_img/61534/rgb(144,144,144)/13?
2025-04-16 09:56:04 - root - INFO - Image téléchargée depuis l'URL: http://r.mail.cbao.fr/tr/op/5JbLgq7JMCd0cW4WUA-lgvTWXWdoLO1_ucWlr1Lq-Aahl3ciesDgM6O8PTgP7DJSRVCBx5lLZeGCOG9eZyn5F6PdDURFrtnzkWtHz8COpP16VAIdOWIpK8w_elOaV8Zi2U1ZjvCAMpCqfCYJYDADVxV2xRjq3plCjFMQ-FWOfmWoDIFWxksfoc2I5mhhnsrw
2025-04-16 09:56:04 - root - INFO - Image téléchargée depuis l'URL: https://odoo.cbao.fr/web/image/145453?access_token=9c5d3a29-fce3-411f-8973-e3f33aa8f32c
2025-04-16 09:56:04 - root - INFO - Image téléchargée depuis l'URL: https://img.mail.cbao.fr/im/2881244/543d7da1b54c29ff43ce5712d1a9aa4962ed21795c4e943fcb8cb84fd4d7465a.jpg?e=kEDXgN0xHfEb-981h_lc_yULm91O7bZKL_LYGfrT2K86Ta7cu921uClZUdgMhvotDWlcCzD3lJtBuoEhqI1Gywup4qaf3_WKJ6oubZu7p_5Stx-yi0SEGpWmdZd7tnRqk39JBwZTv6QvJDmP-3-8a_GVN6XIVj2mk65O7ASevFoYG54BN1Bzy0CebDYuMGOLCZGigDc_ZfReFYMsdxNdUnxNy9uoEFa9wO6djoxvs6pAQkJdPyaJMbf-vC-scsOjG4mbDhUUNKk
2025-04-16 09:56:04 - root - INFO - Image téléchargée depuis l'URL: https://img.mail.cbao.fr/im/2881244/a20f7697fd5e1d1fca3296c6d01228220e0e112c46b4440cc938f74d10934e98.gif?e=J3oCbkWCHi7Jby6t0tMcS8mUioUDEMsJYthetssCVJI9F79WEhd03wXCmZ-MpVe_3kKAdx_UKcZh7LDpl4Os8alPD1hBRHXiL-2qkQEj4lUqUFcIVU3DjuHacMF2VQ1IaigOvBjMSkWrj63_l83dijq9mRqTXSs49fj4n3V7dQhw4xsQKlsroCMU2-_4smR8gNanwzu5M8xZrnbT6s3ze-l71gRqWBrO_iZDm8k3tZTQiEd0IHK_ydL2M7nO2Yqs1hKQsm0BdJW0RoUsbN51VgDXaWpY-XAoBAsEzhDdTyZcNdbwIaGtdhY9TXI72Egw6rdZ69UNJpQ4HuFZOJNYcFm6uCA0LxwFmx5n7nnYcYyY
2025-04-16 09:56:04 - root - ERROR - Erreur lors du téléchargement de l'image depuis /web_editor/font_to_img/61618/rgb(173,181,189)/13: Invalid URL '/web_editor/font_to_img/61618/rgb(173,181,189)/13': No scheme supplied. Perhaps you meant https:///web_editor/font_to_img/61618/rgb(173,181,189)/13?
2025-04-16 09:56:04 - root - ERROR - Erreur lors du téléchargement de l'image depuis /web_editor/font_to_img/61446/rgb(173,181,189)/13: Invalid URL '/web_editor/font_to_img/61446/rgb(173,181,189)/13': No scheme supplied. Perhaps you meant https:///web_editor/font_to_img/61446/rgb(173,181,189)/13?
2025-04-16 09:56:04 - root - ERROR - Erreur lors du téléchargement de l'image depuis /web_editor/font_to_img/61443/rgb(173,181,189)/13: Invalid URL '/web_editor/font_to_img/61443/rgb(173,181,189)/13': No scheme supplied. Perhaps you meant https:///web_editor/font_to_img/61443/rgb(173,181,189)/13?
2025-04-16 09:56:04 - root - INFO - Image téléchargée depuis l'URL: https://odoo.cbao.fr/web/image/145435?access_token=608ac9e7-3627-4a13-a8ec-06ff5046ebf3
2025-04-16 09:56:04 - root - INFO - Total des images extraites: 6
2025-04-16 09:56:04 - root - INFO - 6 images intégrées extraites et ajoutées aux pièces jointes
2025-04-16 09:56:04 - root - INFO - ------------------------------------------------------------
2025-04-16 09:56:04 - root - INFO - Extraction terminée avec succès
2025-04-16 09:56:04 - root - INFO - Ticket: T11143
2025-04-16 09:56:04 - root - INFO - Répertoire: output/ticket_T11143/T11143_20250416_095603
2025-04-16 09:56:04 - root - INFO - Messages traités: 7
2025-04-16 09:56:04 - root - INFO - Pièces jointes: 7
2025-04-16 09:56:04 - root - INFO - ------------------------------------------------------------
2025-04-16 09:57:59 - root - INFO - Extraction du ticket T9656
2025-04-16 09:57:59 - root - INFO - ------------------------------------------------------------
2025-04-16 09:58:00 - root - INFO - Données des messages chargées pour l'extraction des images intégrées
2025-04-16 09:58:00 - root - INFO - Traitement de 3 pièces jointes pour le ticket 9635
2025-04-16 09:58:00 - root - INFO - Pièce jointe téléchargée: image.png (1/3)
2025-04-16 09:58:00 - root - INFO - Pièce jointe téléchargée: image.png (2/3)
2025-04-16 09:58:00 - root - INFO - Pièce jointe téléchargée: image.png (3/3)
2025-04-16 09:58:00 - root - INFO - Extraction des images intégrées aux messages...
2025-04-16 09:58:00 - root - INFO - URLs d'images trouvées dans les messages: 3
2025-04-16 09:58:00 - root - INFO - Image téléchargée depuis l'URL: https://odoo.cbao.fr/web/image/129042?access_token=c60b2fac-c957-4a99-8f20-15154f71ede0
2025-04-16 09:58:00 - root - INFO - Image téléchargée depuis l'URL: https://odoo.cbao.fr/web/image/129046?access_token=5056bf0f-a8a9-451e-beaa-359cd3fad7f9
2025-04-16 09:58:00 - root - INFO - Image téléchargée depuis l'URL: https://odoo.cbao.fr/web/image/129044?access_token=f8a0cbb8-a3c1-4fa8-bd08-ed2674ae9f2f
2025-04-16 09:58:00 - root - INFO - Total des images extraites: 3
2025-04-16 09:58:00 - root - INFO - 3 images intégrées extraites et ajoutées aux pièces jointes
2025-04-16 09:58:00 - root - INFO - ------------------------------------------------------------
2025-04-16 09:58:00 - root - INFO - Extraction terminée avec succès
2025-04-16 09:58:00 - root - INFO - Ticket: T9656
2025-04-16 09:58:00 - root - INFO - Répertoire: output/ticket_T9656/T9656_20250416_095759
2025-04-16 09:58:00 - root - INFO - Messages traités: 5
2025-04-16 09:58:00 - root - INFO - Pièces jointes: 6
2025-04-16 09:58:00 - root - INFO - ------------------------------------------------------------

34
test_extraction.py Normal file
View File

@ -0,0 +1,34 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from odoo.attachment_manager import AttachmentManager
from odoo.auth_manager import AuthManager
import json
import os
def main():
# Initialiser le gestionnaire d'authentification avec des valeurs factices
# puisque nous n'allons pas vraiment nous connecter à Odoo pour ce test
auth = AuthManager(url='https://odoo.cbao.fr', db='dummy', username='dummy', api_key='dummy')
# Chemin vers le dossier du ticket
ticket_folder = 'output/ticket_T11143/T11143_20250416_094512'
# Charger les données des messages
with open(os.path.join(ticket_folder, 'all_messages.json'), 'r') as f:
messages_data = json.load(f)
# Créer le gestionnaire de pièces jointes
am = AttachmentManager(auth)
# Extraire les images manquantes
extracted_images = am.extract_missing_images(messages_data, ticket_folder)
print(f"Nombre d'images extraites: {len(extracted_images)}")
for img in extracted_images:
print(f"Image extraite: {img.get('name', 'Sans nom')} - {img.get('url', '')}")
print("Extraction terminée")
if __name__ == "__main__":
main()