def __init__(self, config, api): """ Constructor. parameters ---------- * config: DBConfig object; specifies database configs. * api: PyApi object. """ self._api = api # Set Datayes PyApi. if config.body: try: self._config = config.body self._client = config.body['client'] self._dbs = config.body['dbs'] self._dbNames = config.body['dbNames'] self._connected = True except KeyError: msg = '[MONGOD]: Unable to configure database; ' + \ 'config file is incomplete.' raise VNPAST_ConfigError(msg) except Exception, e: msg = '[MONGOD]: Unable to configure database; ' + str(e) raise VNPAST_ConfigError(msg)
def __init__(self, config): """ Constructor. parameters ---------- * config: Config object; specifies user and connection configs. """ if config.body: try: self._config = config self._ssl = config.body['ssl'] self._domain = config.body['domain'] self._version = config.body['version'] self._header = config.body['header'] except KeyError: msg = '[API]: Unable to configure api; ' + \ 'config file is incomplete.' raise VNPAST_ConfigError(msg) except Exception, e: msg = '[API]: Unable to configure api; ' + str(e) raise VNPAST_ConfigError(msg)