def remove_token():
    config = get_config()
    url = config.get('url', 'https://api.binstar.org')
    data_dir = appdirs.user_data_dir('binstar', 'ContinuumIO')
    tokenfile = join(data_dir, '%s.token' % quote_plus(url))

    if isfile(tokenfile):
        os.unlink(tokenfile)
Beispiel #2
0
def remove_token():
    config = get_config()
    url = config.get('url', 'https://api.binstar.org')
    data_dir = appdirs.user_data_dir('binstar', 'ContinuumIO')
    tokenfile = join(data_dir, '%s.token' % quote_plus(url))

    if isfile(tokenfile):
        os.unlink(tokenfile)
def load_token(url):
    data_dir = appdirs.user_data_dir('binstar', 'ContinuumIO')
    tokenfile = join(data_dir, '%s.token' % quote_plus(url))
    if isfile(tokenfile):
        with open(tokenfile) as fd:
            token = fd.read()
    else:
        token = None
    return token
Beispiel #4
0
def load_token(url):
    data_dir = appdirs.user_data_dir('binstar', 'ContinuumIO')
    tokenfile = join(data_dir, '%s.token' % quote_plus(url))
    if isfile(tokenfile):
        with open(tokenfile) as fd:
            token = fd.read()
    else:
        token = None
    return token
def store_token(token):
    config = get_config()
    url = config.get('url', 'https://api.binstar.org')

    data_dir = appdirs.user_data_dir('binstar', 'ContinuumIO')
    if not isdir(data_dir):
        os.makedirs(data_dir)
    tokenfile = join(data_dir, '%s.token' % quote_plus(url))

    with open(tokenfile, 'w') as fd:
        fd.write(token)
Beispiel #6
0
def store_token(token):
    config = get_config()
    url = config.get('url', 'https://api.binstar.org')

    data_dir = appdirs.user_data_dir('binstar', 'ContinuumIO')
    if not isdir(data_dir):
        os.makedirs(data_dir)
    tokenfile = join(data_dir, '%s.token' % quote_plus(url))

    with open(tokenfile, 'w') as fd:
        fd.write(token)
    tokenfile = join(data_dir, '%s.token' % quote_plus(url))

    if isfile(tokenfile):
        os.unlink(tokenfile)

def load_config(config_file):
    if exists(config_file):
        with open(config_file) as fd:
            data = yaml.load(fd)
            if data:
                return data

    return {}

SITE_CONFIG = join(appdirs.site_data_dir('binstar', 'ContinuumIO'), 'config.yaml')
USER_CONFIG = join(appdirs.user_data_dir('binstar', 'ContinuumIO'), 'config.yaml')
USER_LOGDIR = appdirs.user_log_dir('binstar', 'ContinuumIO')

def get_config(user=True, site=True):

    config = {}
    if site:
        config.update(load_config(SITE_CONFIG))
    if user:
        config.update(load_config(USER_CONFIG))

    return config

def set_config(data, user=True):

    config_file = USER_CONFIG if user else SITE_CONFIG
Beispiel #8
0
        os.unlink(tokenfile)


def load_config(config_file):
    if exists(config_file):
        with open(config_file) as fd:
            data = yaml.load(fd)
            if data:
                return data

    return {}


SITE_CONFIG = join(appdirs.site_data_dir('binstar', 'ContinuumIO'),
                   'config.yaml')
USER_CONFIG = join(appdirs.user_data_dir('binstar', 'ContinuumIO'),
                   'config.yaml')
USER_LOGDIR = appdirs.user_log_dir('binstar', 'ContinuumIO')


def get_config(user=True, site=True):

    config = {}
    if site:
        config.update(load_config(SITE_CONFIG))
    if user:
        config.update(load_config(USER_CONFIG))

    return config