示例#1
0
 def __init__(self):
     config = ConfigReader()
     self._url = config.configSectionMap('url')['api']
     self.user = config.configSectionMap('user')['name']
     self._password = config.configSectionMap('user')['pass']
     self._headers = {'content-type':'application/json', 'accept':'application/json'}
     
     self.h = httplib2.Http(".cache")
     self.h.add_credentials(self.user, self._password)
示例#2
0
class Configuration(object):
    '''Configuration accessor object wrapping ConfigReader'''
    def __init__(self): 
        self.config = ConfigReader()
        
    def readConf(self):
        '''Read function for ConfigReader returning selected attributes
        @return: Dictionary containing comfiguration parameters
        '''
        conf = {}
        conf['url'] = self.config.configSectionMap('url')['api']
        conf['org'] = self.config.configSectionMap('user')['org']
        conf['user'] = self.config.configSectionMap('user')['name']
        conf['password'] = self.config.configSectionMap('user')['pass']
        conf['headers'] = {'content-type':'application/json', 'accept':'application/json'}
        return conf
示例#3
0
 def __init__(self):
     '''Initialises and sets sel attributes from configreader values in 'const' section'''
     CR = ConfigReader()
     for key in CR.configSectionMap('const'):
         val = CR.configSectionMap('const')[key]
         setattr(self, key.upper(), val)
示例#4
0
 def __init__(self):
     '''Initialises and sets sel attributes from configreader values in 'const' section'''
     CR = ConfigReader()
     for key in CR.configSectionMap('const'):
         val = CR.configSectionMap('const')[key]
         setattr(self, key.upper(), val) 
示例#5
0
################################################################################

import psycopg2
from Error import Error
import Config
from Config import ConfigReader
from AimsUI.AimsLogging import Logger

aimslog = Logger.setup()

_db = None
_autocommit = True
_restartRequired = False

config = ConfigReader()
_host = config.configSectionMap('db')['host']
_port = config.configSectionMap('db')['port']
_name = config.configSectionMap('db')['name']
_user = config.configSectionMap('db')['user']
_password = config.configSectionMap('db')['password']

_aimsSchema='reference'


def setup(d):
    aimslog.info('Setting DB, {}'.format(d))
    setHost(d['host'])
    setPort(d['port'])
    setDatabase(d['name']) 
    setAimsSchema(d['aimsschema'])
    setUser(d['user'])