etat_libre_2020/entites.py

25 lines
557 B
Python
Executable file

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 9 09:53:25 2020
@author: francois
"""
from questionary import prompt
import questions_entite as qe
import dataset
choix_entite = prompt(qe.choix_entite)
reponses = prompt(qe.questions_entite[choix_entite['type']])
print("Choix:\n"+str(choix_entite)+"\nRéponse:\n"+str(reponses))
psql_string = 'postgresql://etatdulibre:etatdulibre@172.19.0.2/etatdulibre'
try:
db = dataset.connect(psql_string)
table = db[choix_entite['type']]
table.insert(reponses)
except:
pass