def _config_load(logger, cfg_file=os.path.dirname(__file__) + '/' + 'hockeygraphs.cfg'): """" load config from file """ logger.debug('_config_load()') consumer_key = None consumer_secret = None oauth_token = None oauth_token_secret = None config_dic = config_load(cfg_file=cfg_file) if 'Twitter' in config_dic: if 'consumer_key' in config_dic['Twitter']: consumer_key = config_dic['Twitter']['consumer_key'] if 'consumer_secret' in config_dic['Twitter']: consumer_secret = config_dic['Twitter']['consumer_secret'] if 'oauth_token' in config_dic['Twitter']: oauth_token = config_dic['Twitter']['oauth_token'] if 'oauth_token_secret' in config_dic['Twitter']: oauth_token_secret = config_dic['Twitter']['oauth_token_secret'] if not (consumer_key and consumer_secret and oauth_token and oauth_token_secret): logger.debug('_config_load(): twitter configuration incomplete') sys.exit(0) logger.debug('_config_load() ended.') return (consumer_key, consumer_secret, oauth_token, oauth_token_secret)
def _config_load(logger, cfg_file=os.path.dirname(__file__)+'/'+'hockeygraphs.cfg'): """" load config from file """ logger.debug('_config_load()') rebound_interval = 0 break_interval = 0 config_dic = config_load(cfg_file=cfg_file) if 'Shots' in config_dic: if 'rebound_interval' in config_dic['Shots']: rebound_interval = int(config_dic['Shots']['rebound_interval']) if 'break_interval' in config_dic['Shots']: break_interval = int(config_dic['Shots']['break_interval']) logger.debug('_config_load() ended.') return (rebound_interval, break_interval)
def _config_load(self): """" load config from file """ self.logger.debug('_config_load()') config_dic = config_load(cfg_file=os.path.dirname(__file__) + '/' + 'hockeygraphs.cfg') if 'Tools' in config_dic: if 'base_url' in config_dic['Tools']: self.base_url = config_dic['Tools']['base_url'] if 'mobile_api' in config_dic['Tools']: self.mobile_api = config_dic['Tools']['mobile_api'] if 'del_api' in config_dic['Tools']: self.del_api = config_dic['Tools']['del_api'] if 'Shifts' in config_dic and 'shift_name' in config_dic['Shifts']: self.shift_name = config_dic['Shifts']['shift_name'] self.logger.debug('_config_load() ended.')
def _config_load(logger, cfg_file=os.path.dirname(__file__) + '/' + 'hockeygraphs.cfg'): """" load config from file """ logger.debug('_config_load()') fb_token_file = None config_dic = config_load(cfg_file=cfg_file) if 'Facebook' in config_dic: if 'token_file' in config_dic['Facebook']: fb_token_file = config_dic['Facebook']['token_file'] if not fb_token_file: logger.debug('_config_load(): facebook configuration incomplete') sys.exit(0) logger.debug('_config_load() ended.') return fb_token_file
def _config_load(logger, cfg_file=os.path.dirname(__file__)+'/'+'hockeygraphs.cfg'): """" load config from file """ logger.debug('_config_load()') app_name = None app_id = None app_secret = None config_dic = config_load(cfg_file=cfg_file) if 'Facebook' in config_dic: if 'app_name' in config_dic['Facebook']: app_name = config_dic['Facebook']['app_name'] if 'app_id' in config_dic['Facebook']: app_id = config_dic['Facebook']['app_id'] if 'app_secret' in config_dic['Facebook']: app_secret = config_dic['Facebook']['app_secret'] if not (app_name and app_id and app_secret): logger.debug('_config_load(): Facebook configuration incomplete') sys.exit(0) logger.debug('_config_load() ended.') return (app_name, app_id, app_secret)