28/02/23 - 17h45

master
cherif 2023-02-28 17:46:09 +01:00
parent 5e772694e3
commit fce7bfaa19
8 changed files with 8508 additions and 62 deletions

View File

@ -1,11 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="22/02/23 20h">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="24/02/23 - 23h23">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/business_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/business_prices.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -324,7 +327,14 @@
<option name="project" value="LOCAL" />
<updated>1677094867932</updated>
</task>
<option name="localTasksCounter" value="37" />
<task id="LOCAL-00037" summary="24/02/23 - 23h23">
<created>1677277431565</created>
<option name="number" value="00037" />
<option name="presentableId" value="LOCAL-00037" />
<option name="project" value="LOCAL" />
<updated>1677277431565</updated>
</task>
<option name="localTasksCounter" value="38" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -339,7 +349,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="20/12/22 - 15h30" />
<MESSAGE value="24/12/2022 - 15h00" />
<MESSAGE value="27/12/2022 - 11h00" />
<MESSAGE value="27/12/2022 - 16h00" />
@ -364,7 +373,8 @@
<MESSAGE value="17/02/23 - 14h" />
<MESSAGE value="20/02/23 - 11h" />
<MESSAGE value="22/02/23 20h" />
<option name="LAST_COMMIT_MESSAGE" value="22/02/23 20h" />
<MESSAGE value="24/02/23 - 23h23" />
<option name="LAST_COMMIT_MESSAGE" value="24/02/23 - 23h23" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

File diff suppressed because it is too large Load Diff

View File

@ -384,7 +384,7 @@ def GetActiveSessionFormation_List(diction):
print("####RetObject = "+str(RetObject))
#print("####RetObject = "+str(RetObject))
return True, RetObject

View File

@ -34,7 +34,7 @@ def add_business_price(diction):
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
# field_list.
'''
field_list = ['token', 'client_recid', 'discount', 'date_du', 'date_au']
field_list = ['token', 'client_recid', 'discount', 'date_du', 'date_au', 'class']
incom_keys = diction.keys()
for val in incom_keys:
@ -104,6 +104,9 @@ def add_business_price(diction):
mydata['date_du'] = date_du
mydata['date_au'] = date_au
if ("class" in diction.keys()):
if diction['class']:
mydata['class'] = diction['class']
client_recid = str(diction['client_recid']).strip()
local_status, local_val = mycommon.get_partner_data_from_recid(client_recid)
@ -145,7 +148,7 @@ def update_business_price(diction):
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
# field_list.
'''
field_list = ['token', 'price_id', 'discount', 'date_du', 'date_au']
field_list = ['token', 'price_id', 'discount', 'date_du', 'date_au', 'class']
incom_keys = diction.keys()
for val in incom_keys:
@ -204,6 +207,11 @@ def update_business_price(diction):
mydata['date_au'] = date_au
mydata['date_update'] = datetime.now().strftime("%d/%m/%Y")
if ("class" in diction.keys()):
if diction['class']:
mydata['class'] = diction['class']
ret_val = MYSY_GV.dbname['business_prices'].find_one_and_update(
{'_id': ObjectId(str(str(diction['price_id']).strip())), },
{"$set": mydata},

View File

@ -1729,7 +1729,7 @@ def get_class(diction):
# field_list.
'''
field_list = ['internal_url', 'token', 'title', 'valide', 'locked', 'user_ip', 'user_country_code', 'user_country_name', 'user_city',
'user_postal', 'user_latitude', 'user_longitude', 'user_state']
'user_postal', 'user_latitude', 'user_longitude', 'user_state', 'connection_type']
incom_keys = diction.keys()
for val in incom_keys:
@ -1762,6 +1762,14 @@ def get_class(diction):
if diction['token']:
my_token = diction['token']
client_connected_recid = ""
connection_type = ""
if ("connection_type" in diction.keys()):
if diction['connection_type']:
connection_type = diction['connection_type']
'''
Gestion des filters.
@ -1795,7 +1803,7 @@ def get_class(diction):
coll_search_result = MYSY_GV.dbname['user_recherche_result']
# Verification de la validité du token/mail dans le cas des user en mode connecté
if (len(str(my_token)) > 0):
if (len(str(my_token)) > 0 and str(connection_type).strip() == "user"):
retval = mycommon.check_token_validity("", my_token)
if retval is False:
@ -1808,6 +1816,22 @@ def get_class(diction):
mycommon.myprint(str(inspect.stack()[0][3])+" - Impossible de recuperer le token de l'utilisateur")
return False, " Impossible de recuperer la formation"
# Verification de la validité du token/mail dans le cas des partner en mode connecté
if (len(str(my_token)) > 0 and str(connection_type).strip() == "partner"):
retval = mycommon.check_partner_token_validity("", my_token)
if retval is False:
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
return False, "Le token n'est pas valide"
# Recuperation du recid de l'utilisateur
user_recid = mycommon.get_parnter_recid_from_token(my_token)
if user_recid is False:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - Impossible de recuperer le token du partenaire")
return False, " Impossible de recuperer le token du partenaire"
RetObject = []
filt_external_code = {}
internal_url = ""
@ -1851,12 +1875,62 @@ def get_class(diction):
"""
nb_pave_a_afficher = 0
for retVal in coll_name.find({'valide':'1','locked':'0','internal_url':internal_url, 'published':'1'},
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
"valide": 0, "locked": 0, "partner_owner_recid": 0, }
).limit(1):
connected_client_recid = ""
if (str(connection_type).strip() == "partner"):
connected_client_recid = user_recid
pipe = [
{'$match': {'internal_url': internal_url, 'published': '1'}},
{'$project': {'_id': 0, 'indexed': 0, 'indexed_desc': 0, 'indexed_obj': 0, "indexed_title": 0, "valide": 0,
"locked": 0}},
{'$lookup':
{
'from': 'business_prices',
'let': {'partner_owner_recid': "$partner_owner_recid", 'programme': '$programme'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$partner_recid", "$$partner_owner_recid"]},
{'$eq': ["$client_recid", connected_client_recid]},
{'$eq': ["$valide", "1"]}
]
}
}
},
],
'as': 'business_prices'
}
}
]
print(" ### pipe myclass = ", pipe)
for retVal in coll_name.aggregate(pipe):
"""
for retVal in coll_name.find({'valide':'1','locked':'0','internal_url':internal_url, 'published':'1'},
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
"valide": 0, "locked": 0, "partner_owner_recid": 0, }
).limit(1):
"""
print('#### ICI retVal = '+str(retVal))
if ("business_prices" in retVal.keys()):
if(len(retVal['business_prices']) > 0 and "discount" in retVal['business_prices'][0].keys() ):
"""
Calcal du prix discounté
"""
#print(" ### discount = ", x['business_prices'][0]['discount'], " PRIX initial = ", x['price'])
local_discount = mycommon.tryFloat(str(retVal['business_prices'][0]['discount']))
local_initial_price = mycommon.tryFloat(str(retVal['price']))
local_discounted_price = round( local_initial_price - (local_initial_price * (local_discount/100)), 2)
retVal['business_prices'][0]['discounted_price'] = str(local_discounted_price)
#print(" #### local_discounted_price = ", local_discounted_price)
#print('ICI retVal = '+str(retVal))
my_recid = {}
my_recid['user_rec_id'] = str(user_recid)
mydict_combined = {**diction, **retVal, **my_recid}

View File

@ -1,7 +1,4 @@
,index,mots,occurence,moyenne,id_formation,source_field
0,0,orthographe,1,0.17,LPP_0004,title
1,1,niveau,1,0.17,LPP_0004,title
2,2,heure,1,0.17,LPP_0004,title
3,3,formule,1,0.17,LPP_0004,title
4,4,learning,1,0.17,LPP_0004,title
5,5,tutorat,1,0.17,LPP_0004,title
0,0,aromatherapie,1,0.33,AR,title
1,1,integrative,1,0.33,AR,title
2,2,praticien,1,0.33,AR,title

1 index mots occurence moyenne id_formation source_field
2 0 0 orthographe aromatherapie 1 0.17 0.33 LPP_0004 AR title
3 1 1 niveau integrative 1 0.17 0.33 LPP_0004 AR title
4 2 2 heure praticien 1 0.17 0.33 LPP_0004 AR title
3 3 formule 1 0.17 LPP_0004 title
4 4 learning 1 0.17 LPP_0004 title
5 5 tutorat 1 0.17 LPP_0004 title

View File

@ -1,7 +1,4 @@
mots occurence moyenne id_formation source_field
0 orthographe 1 0.17 LPP_0004 title
1 niveau 1 0.17 LPP_0004 title
2 heure 1 0.17 LPP_0004 title
3 formule 1 0.17 LPP_0004 title
4 learning 1 0.17 LPP_0004 title
5 tutorat 1 0.17 LPP_0004 title
mots occurence moyenne id_formation source_field
0 aromatherapie 1 0.33 AR title
1 integrative 1 0.33 AR title
2 praticien 1 0.33 AR title

View File

@ -125,7 +125,7 @@ def get_all_class(diction):
# Dictionnaire des champs utilisables
field_list = ['token', 'user_ip', 'user_country_code', 'user_country_name', 'user_city',
'user_postal', 'user_latitude', 'user_longitude', 'user_state', 'search_text', 'certif',
'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf']
'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf', 'connection_type']
incom_keys = diction.keys()
@ -175,6 +175,16 @@ def get_all_class(diction):
if diction['user_state']:
mydata['user_state'] = diction['user_state']
connection_type = ""
if ("connection_type" in diction.keys()):
if diction['connection_type']:
connection_type = diction['connection_type']
token = ""
if ("token" in diction.keys()):
if diction['token']:
token = diction['token']
#print(" My Data ="+str(mydata))
status, tab_training_inzone = get_training_in_user_zone(diction)
@ -194,6 +204,21 @@ def get_all_class(diction):
alread_found.append(str(stud_obj['external_code']))
#print(" stud_obj = "+str(stud_obj['external_code']))
user_recid = "None"
# Verification de la validité du token/mail dans le cas des partner en mode connecté
if (len(str(token)) > 0 and str(connection_type).strip() == "partner"):
retval = mycommon.check_partner_token_validity("", token)
if retval is False:
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
return False, "Le token n'est pas valide"
# Recuperation du recid de l'utilisateur
user_recid = mycommon.get_parnter_recid_from_token(token)
if user_recid is False:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - Impossible de recuperer le token de l'utilisateur")
return False, " Impossible de recuperer le token de l'utilisateur"
"""
Travail à faire :
@ -215,17 +240,60 @@ def get_all_class(diction):
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
"valide": 0, "locked": 0, }).\
"""
for x in coll_name.find(
{"$and": [{"$or": [{'valide': '1', 'locked': '0', 'isalaune': '1', 'published': '1'},
{'coeur': 1, 'published': '1'}]},
{'external_code': {'$nin': alread_found}}
]},
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
"valide": 0, "locked": 0, }).\
limit(nb_formation_a_jouter).\
sort(
[("display_rank", pymongo.DESCENDING), ("price", pymongo.ASCENDING), ("date_update", pymongo.DESCENDING) ]):
connected_client_recid = ""
if (str(connection_type).strip() == "partner"):
connected_client_recid = user_recid
pipe = [{'$match':
{"$and": [{"$or": [{'valide': '1', 'locked': '0', 'isalaune': '1', 'published': '1'},
{'coeur': 1, 'published': '1'}]},
{'external_code': {'$nin': alread_found}},
{'display_rank': {'$nin': []}}
]}
},
{'$project': {'_id': 0, 'indexed': 0, 'indexed_desc': 0, 'indexed_obj': 0, "indexed_title": 0,
"valide": 0, "locked": 0}},
{'$lookup':
{
'from': 'business_prices',
'let': {'partner_owner_recid': "$partner_owner_recid", 'programme': '$programme'},
'pipeline': [
{'$match':
{'$expr':
{'$and':
[
{'$eq': ["$partner_recid", "$$partner_owner_recid"]},
{'$eq': ["$client_recid", connected_client_recid]},
{'$eq': ["$valide", "1"]}
]
}
}
},
],
'as': 'business_prices'
}
},
{ '$sort': {"display_rank": pymongo.DESCENDING, "price": pymongo.ASCENDING, "date_update": pymongo.DESCENDING}},
{'$limit': nb_formation_a_jouter},
]
print(" ### pipe = ", pipe)
for x in coll_name.aggregate(pipe):
"""
for x in coll_name.find(
{"$and": [{"$or": [{'valide': '1', 'locked': '0', 'isalaune': '1', 'published': '1'},
{'coeur': 1, 'published': '1'}]},
{'external_code': {'$nin': alread_found}}
]},
{"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0,
"valide": 0, "locked": 0, }).\
limit(nb_formation_a_jouter).\
sort(
[("display_rank", pymongo.DESCENDING), ("price", pymongo.ASCENDING), ("date_update", pymongo.DESCENDING) ]):
"""
#print("AVANT ==> "+str(x['description']))
val = x['description']
@ -237,6 +305,20 @@ def get_all_class(diction):
#mycommon.myprint("APRES ==> " + str(x['description']))
if ("business_prices" in x.keys()):
# print(" ### business_prices = ", x['business_prices'], " len(x['business_prices']) = ", len(x['business_prices']))
if (len(x['business_prices']) > 0 and "discount" in x['business_prices'][0].keys()):
"""
Calcal du prix discounté
"""
# print(" ### discount = ", x['business_prices'][0]['discount'], " PRIX initial = ", x['price'])
local_discount = mycommon.tryFloat(str(x['business_prices'][0]['discount']))
local_initial_price = mycommon.tryFloat(str(x['price']))
local_discounted_price = round(local_initial_price - (local_initial_price * (local_discount / 100)),
2)
x['business_prices'][0]['discounted_price'] = str(local_discounted_price)
# print(" #### local_discounted_price = ", local_discounted_price)
user = x
user['id'] = str(val_tmp)
insertObject.append(JSONEncoder().encode(user))
@ -280,7 +362,7 @@ def get_training_in_user_zone(diction):
# Dictionnaire des champs utilisables
field_list = ['token', 'user_ip', 'user_country_code', 'user_country_name', 'user_city',
'user_postal', 'user_latitude', 'user_longitude', 'user_state', 'search_text', 'certif',
'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf']
'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf', 'connection_type']
incom_keys = diction.keys()
@ -406,7 +488,7 @@ def recherche_text_simple(diction):
'''
field_list = ['token', 'user_ip', 'user_country_code', 'user_country_name', 'user_city',
'user_postal', 'user_latitude', 'user_longitude', 'user_state', 'search_text', 'certif',
'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf']
'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf', 'connection_type']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list:
@ -433,6 +515,7 @@ def recherche_text_simple(diction):
new_diction = {}
new_diction['token'] = ""
if ("search_text" in diction.keys()):
if diction['search_text']:
search_text = diction['search_text']
@ -443,18 +526,30 @@ def recherche_text_simple(diction):
token = diction['token']
new_diction['token'] = diction['token']
connection_type = ""
if ("connection_type" in diction.keys()):
if diction['connection_type']:
connection_type = diction['connection_type']
'''
Recuperation de donnée du user connecté si connexion (user ou partner)
/!\ Important : si le token est vide, alors c'est une recherche faite en mode non-connecté.
on doit l'accepter.
Si non le champ "connection_type" permet de savoir si c'est un user ou un partner
le controle de la validé du token est faite que ce dernier n'est pas vide.
'''
user_recid = "None"
coll_search_result = MYSY_GV.dbname['user_recherche_result']
# Verification de la validité du token/mail dans le cas des user en mode connecté
if ( len(str(token)) > 0 ):
if ( len(str(token)) > 0 and str(connection_type).strip() == "user"):
retval = mycommon.check_token_validity("", token)
if retval is False :
@ -465,7 +560,22 @@ def recherche_text_simple(diction):
user_recid = mycommon.get_user_recid_from_token(token)
if user_recid is False:
mycommon.myprint(str(inspect.stack()[0][3])+" - Impossible de recuperer le token de l'utilisateur")
return False, " Impossible de desactiver l'objectif utilisateur"
return False, " Impossible de recuperer le token de l'utilisateur"
# Verification de la validité du token/mail dans le cas des partner en mode connecté
if (len(str(token)) > 0 and str(connection_type).strip() == "partner"):
retval = mycommon.check_partner_token_validity("", token)
if retval is False:
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
return False, "Le token n'est pas valide"
# Recuperation du recid de l'utilisateur
user_recid = mycommon.get_parnter_recid_from_token(token)
if user_recid is False:
mycommon.myprint(
str(inspect.stack()[0][3]) + " - Impossible de recuperer le token de l'utilisateur")
return False, " Impossible de recuperer le token de l'utilisateur"
#mycommon.myprint(" On recehrche la phrase +'" + search_text + "' + user_recid = "+user_recid)
@ -637,17 +747,16 @@ def recherche_text_simple(diction):
insertObject = []
"""
23/02/2023 : Uniquement pour des raisons de tests
"""
test_client_recid = "7ad3a72c9b161045cc50a7590e5fd18289a41389dca44386c6"
connected_client_recid = ""
if( str(connection_type).strip() == "partner"):
connected_client_recid = user_recid
"""
23/02/2023 : FIN Uniquement pour des raisons de tests
"""
"""
"""
for x in coll_name.find({"external_code":{"$in":tab_training}, 'published':'1'},
{"_id": 0, "indexed": 0, "indexed_desc": 0,
"indexed_obj": 0, "indexed_title": 0, "valide": 0,
@ -655,7 +764,7 @@ def recherche_text_simple(diction):
"""
pipe = [
{ '$match': {'external_code': {"$in": ['AP', 'OP', 'AR']}} },
{ '$match': {'external_code': {"$in": tab_training}, 'published':'1'} },
{ '$project': { '_id': 0, 'indexed': 0, 'indexed_desc': 0, 'indexed_obj': 0, "indexed_title": 0, "valide": 0, "locked": 0} },
{ '$lookup':
{
@ -669,8 +778,8 @@ def recherche_text_simple(diction):
{ '$and':
[
{ '$eq': [ "$partner_recid", "$$partner_owner_recid" ] },
{ '$eq': [ "$client_recid", "1ba5aacb6f00d37cf9017858118d281ab8776dbd7916ae1899" ] },
{ '$eq': [ "$valide", "2" ] }
{ '$eq': [ "$client_recid", connected_client_recid ] },
{ '$eq': [ "$valide", "1" ] }
]
}
}
@ -680,15 +789,19 @@ def recherche_text_simple(diction):
],
'as': 'business_prices'
}
}
},
{'$sort': {"display_rank": pymongo.DESCENDING, "price": pymongo.ASCENDING,
"date_update": pymongo.DESCENDING}},
]
#print(" ### pipe = ", pipe)
print(" ### pipe recherche_text_simple = ", pipe)
for x in coll_name.aggregate(pipe):
nb_result = nb_result + 1
if ("business_prices" in x.keys()):
if( "discount" in x['business_prices'][0].keys() ):
#print(" ### business_prices = ", x['business_prices'], " len(x['business_prices']) = ", len(x['business_prices']))
if(len(x['business_prices']) > 0 and "discount" in x['business_prices'][0].keys() ):
"""
Calcal du prix discounté
"""
@ -768,7 +881,7 @@ def recherche_text_simple(diction):
print(str(x['url'])+" existe deja, pas d'ajout à faire ")
'''
print("#### #", insertObject)
#print("#### #", insertObject)
#print(" result ok ")
''' en cas de resultat vide, enregsitrement de la requete de recherche avec les filtres associé'''
if (nb_result == 0):
@ -796,9 +909,6 @@ def recherche_text_simple(diction):
'''
Cette fonction enregistre les recherches faites par les user
dans la base de données.
@ -839,12 +949,12 @@ def store_recherche(diction, user_recid=""):
field_list = ['token', 'user_ip', 'user_country_code', 'user_country_name', 'user_city',
'user_postal', 'user_latitude', 'user_longitude', 'user_state', 'search_text', 'certif',
'support', 'type', 'lang', 'price', 'distance', 'duration']
'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf', 'connection_type']
incom_keys = diction.keys()
for val in incom_keys:
if val not in field_list:
mycommon.myprint(str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'existe pas, recherche annulée")
return False, " Le champ '" + val + "' n'existe pas, recherche annulée", None
mycommon.myprint(str(inspect.stack()[0][3]) + " Le champ '" + val + "' n'est pas autorisé")
return False, " Le champ '" + val + "' n'est pas autorisé", None
'''
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
@ -905,6 +1015,10 @@ def store_recherche(diction, user_recid=""):
if diction['price']:
mydata['price'] = diction['price']
if ("connection_type" in diction.keys()):
if diction['connection_type']:
mydata['connection_type'] = diction['connection_type']
if ("certif" in diction.keys()):
if diction['certif']:
mydata['certif'] = diction['certif']