05/06/22 - 14h30

master
ChérifBALDE 2022-08-04 20:38:32 +02:00 committed by cherif
parent 2c42b09713
commit f57e41fc35
1 changed files with 67 additions and 0 deletions

67
chat_mgt.py Normal file
View File

@ -0,0 +1,67 @@
"""
Ce fichier permet de gerer les message chat
"""
import pymongo
from pymongo import MongoClient
import json
from bson import ObjectId
import re
from datetime import datetime
import prj_common as mycommon
import secrets
import inspect
import sys, os
import csv
import pandas as pd
from pymongo import ReturnDocument
import GlobalVariable as MYSY_GV
from math import isnan
import GlobalVariable as MYSY_GV
class JSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, ObjectId):
return str(o)
return json.JSONEncoder.default(self, o)
'''
Cette fonction enregister un message
'''
def add_chat(diction):
try:
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de recuperer le chat"
'''
Cette fonction recuperer un message avec un id donnée
'''
def get_chat_by_id(diction):
try:
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de recuperer le chat"
'''
Cette fonction recupere tous les message en attente de traitement
'''
def get_non_anwered_chat(diction):
try:
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de recuperer le chat"