Maj module

This commit is contained in:
Boris Tassou 2019-12-03 14:58:19 +01:00
parent 9acf0f5a7e
commit 918de9e524
8 changed files with 11 additions and 12 deletions

2
.gitignore vendored
View file

@ -1 +1 @@
conf.ini
config/conf.ini

View file

@ -21,5 +21,5 @@ __license__ = 'Beerware'
try:
import pymysql
except ImportError:
print('PyMSQL library not found')
print('PyMYSQL library not found')
sys.exit(1)

View file

@ -1,5 +0,0 @@
[sql]
host=localhost
database=adherents_services
user=root
passwd=Boris1989!

View file

@ -15,7 +15,7 @@ from configparser import SafeConfigParser
import pymysql
# Read conf.ini
INI_CONF = "./conf.ini"
INI_CONF = "./config/conf.ini"
CONFIG = SafeConfigParser()
CONFIG.read(INI_CONF)
@ -30,7 +30,7 @@ class HandleSql:
"""Class to handle sql connection."""
@staticmethod
def sql_check():
def sql_checkcon():
"""Init sql connection."""
try:
global conn

View file

@ -3,7 +3,11 @@
from manage_sql.manage_sql import HandleSql
MY_PSQL_CONN = HandleSql()
MY_SQL_CONN = HandleSql()
check_return_bdd = MY_PSQL_CONN.psql_checkcon()
try:
check_return_bdd = MY_SQL_CONN.sql_checkcon()
except OperationalError as error:
print(error)
else:
print(check_return_bdd)