You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
578 B
24 lines
578 B
2 years ago
|
from configparser import ConfigParser
|
||
|
|
||
|
|
||
|
def config(filename='database.ini', section='postgres'):
|
||
|
# create a parser
|
||
|
parser = ConfigParser()
|
||
|
# read config file
|
||
|
parser.read(filename)
|
||
|
|
||
|
# get section, default to postgresql
|
||
|
db = {}
|
||
|
if parser.has_section(section):
|
||
|
params = parser.items(section)
|
||
|
for param in params:
|
||
|
db[param[0]] = param[1]
|
||
|
else:
|
||
|
raise Exception('Section {0} not found in the {1} file'.format(section, filename))
|
||
|
|
||
|
return db
|
||
|
|
||
|
|
||
|
def tunnel(ip, username, pk, remote_bind, local_bind):
|
||
|
print("A")
|