Exemple #1
0
def configure_endomondo(conf):
    endomondoapi = MobileApi()
    email = ''
    password = ''

    while not email:
	email = raw_input('Please enter your endomondo email: ')

    while not password:
	password = getpass.getpass()
	if not password:
	    print 'Password can\'t be empty'

    auth_token = ''
    try:
	auth_token = endomondoapi.request_auth_token(email=email, password=password)
    except:
	pass
    if not auth_token:
	print 'Did not receive valid authentication token. Try one more time.'
    else:
	conf['endomondo'] = True
	conf['email'] = email
	keyring.set_password("endomondo", email, auth_token)
	print 'Configured!'
Exemple #2
0
    auth_token = None
    if not pw:
        auth_token = keyring.get_password("endomondo", email)

    pprint(endomondoapi.device_info)

    while not auth_token:
        while not pw:
            print "No authentication token, using password authentication."
            pw = getpass.getpass()
            if not pw:
                print "Password can't be empty"

        try:
            auth_token = endomondoapi.request_auth_token(email=email,
                                                         password=pw)
        except:
            pass

        if not auth_token:
            print "Did not receive valid authentication token."
            pw = ''
        else:
            keyring.set_password("endomondo", email, auth_token)

    endomondoapi.set_auth_token(auth_token)

    ##
    ## * Retrieve user profile info
    ##
    user_data = endomondoapi.get_account_info()['data']
	auth_token = None
	if not pw:
		auth_token = keyring.get_password("endomondo", email)

	pprint(endomondoapi.device_info)

	while not auth_token:
		while not pw:
			print "No authentication token, using password authentication."
			pw = getpass.getpass()
			if not pw:
				print "Password can't be empty"

		try:
			auth_token = endomondoapi.request_auth_token(email=email, password=pw)
		except:
			pass

		if not auth_token:
			print "Did not receive valid authentication token."
			pw = ''
		else:
			keyring.set_password("endomondo", email, auth_token)

	endomondoapi.set_auth_token(auth_token)

	##
	## * Retrieve user profile info
	##
	user_data = endomondoapi.get_account_info()['data']