db_url = 'http://47.93.89.99:8765'
from traceback import format_excimport phoenixdb as pbclass Utils(object): def get_db_conn(self, url): """ this function is able to get database connection :param url: Database url :return: database connection """ try: _conn = pb.connect(url, autocommit=True) cr = _conn.cursor() print('get connection success....') return cr, _conn except: try: _conn = pb.connect(url, autocommit=True) cr = _conn.cursor() return cr, _conn except: cr = 'err' _conn = format_exc() return cr, _conn