예제 #1
0
def register_device_remotely(name):
    '''
    Register device to target Cozy
    '''
    (url, path) = local_config.get_config(name)
    if url[-1:] == '/':
        url = url[:-(len(name)+1)]
    password = getpass.getpass('Type your Cozy password to register your '
                               'device remotely:\n')
    (device_id, device_password) = remote.register_device(name, url,
                                                          path, password)
    local_config.set_device_config(name, device_id, device_password)
예제 #2
0
def register_device_remotely(name, password=None):
    '''
    Register device to target Cozy
    '''
    (url, path) = local_config.get_config(name)
    # Remove trailing slash
    url = url.rstrip('/')
    if password is None:
        password = getpass.getpass('Type your Cozy password to register your '
                                   'device remotely:\n')
    (device_id, device_password) = remote.register_device(name, url,
                                                          path, password)
    local_config.set_device_config(name, device_id, device_password)
예제 #3
0
def register_device_remotely(name, password):
    '''
    Register device to target Cozy
    '''
    (url, path) = local_config.get_config(name)
    if url[-1:] == '/':
        url = url[:-(len(name)+1)]
    try:
        (device_id, device_password) = remote.register_device(name, url,
                                                          path, password)

        local_config.set_device_config(name, device_id, device_password)

    except remote.WrongCozyURL, e:
        local_config.remove_config(name)
        raise ProcessedException(e)