diff --git a/05 testik.py b/05 testik.py new file mode 100644 index 0000000..48cda59 --- /dev/null +++ b/05 testik.py @@ -0,0 +1,4 @@ +import socket + +computer_name = socket.gethostname() +print(computer_name) \ No newline at end of file diff --git a/functions.py b/functions.py index 614717c..aa56af9 100644 --- a/functions.py +++ b/functions.py @@ -13,13 +13,8 @@ import pymysql from pymysql.cursors import DictCursor import fdb -MEDICUS_CFG = dict( - dsn=r"192.168.1.4:z:\medicus 3\data\medicus.fdb", - user="SYSDBA", - password="masterkey", - charset="win1250", -) +import socket def get_medicus_connection(): """ Attempt to create a Firebird connection to the Medicus database. @@ -27,6 +22,15 @@ def get_medicus_connection(): fdb.Connection object on success None on failure """ + if socket.gethostname().strip()=="NTBVBHP470G10": + MEDICUS_CFG = dict( + dsn=r"192.168.1.4:z:\medicus 3\data\medicus.fdb", + user="SYSDBA", + password="masterkey", + charset="win1250", + ) + elif: + try: return fdb.connect(**MEDICUS_CFG) except fdb.fbcore.DatabaseError as e: