Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (23 sloc) 821 Bytes
#!/usr/bin/env python
#-*- coding:utf-8 -*-
__author__ = 'p0123n'
from os import path
myPath = path.abspath(path.dirname(__file__))
import ConfigParser
config = ConfigParser.ConfigParser()
config.readfp(open('%s/mybases.conf'%myPath))
from mygate import MyGate
# You can switch 'localhost' to any
# other mostly used data base.
def init(server = 'localhost'):
params = dict()
params['addr'] = str(config.get(server, 'addr'))
params['port'] = int(config.get(server, 'port'))
params['user'] = str(config.get(server, 'user'))
params['pass'] = str(config.get(server, 'pass'))
params['name'] = str(config.get(server, 'name'))
params['tmzn'] = str(config.get(server, 'tmzn'))
return MyGate(params)
if __name__ == '__main__':
gate = init()
print gate.query('select version()')