Ejemplo n.º 1
0
def get_cloud_app_client():
    """

    Gets the specified TwitterApplication instance (or prompts you to create it)

    :returns:  TwitterApplication.

    """

    try:
        client = CloudAppClient.get()
    except NoDefaultExistsError:
        account = prompt_new_cloud_app_account()
        client = CloudAppClient.get()
Ejemplo n.º 2
0
def prompt_new_cloud_app_account():
    
    # Have the user give us their username/password
    print "---------------"
    print "I need to store your Cloudapp username/password for URL shortening."
    print "(FYI: These will be stored in the clear in your local mongoDB.)"

    username = string_prompt("Enter your Cloudapp username:"******"Enter your Cloudapp password:"******"username": username,
            "password": password,
            "default": True,
            })

    # This will confirm that auth works:
    test_client = CloudAppClient.get(account=account)

    # Save the account to mongo and return it:
    account.save()

    print ""
    print "CloudApp Account successfully stored!"
    print ""

    return account