def get_credential(section='default'):
    if os.environ.get('TRAVIS_TEST'):
        username = os.environ.get('TEST_USER_USERNAME')
        password = os.environ.get('TEST_USER_PASSWORD')
        if username is None or password is None:
            msg = 'No credentials environment variables found.'
            raise ConfigError(msg)
    elif CREDENTIALS is not None:
        CONFIG.read(CREDENTIALS)
        if CONFIG.has_section(section):
            items = dict(CONFIG.items(section))
            try:
                username = items['username']
                password = items['password']
            except __HOLE__ as e:
                msg = 'Key "%s" not found in credentials file.' % e.args[0]
                raise ConfigError(msg)
        else:
            msg = 'No section named "%s" found in credentials file.' % section
            raise ConfigError(msg)
    else:
        msg = 'No credentials file found.'
        raise ConfigError(msg)
    return {'username': username, 'password': password}
dataset/ETHPy150Open shichao-an/115wangpan/u115/conf.py/get_credential