Get authentication details to jottacloud.

    Will first check environment variables, then the .netrc file.

def get_auth_info():
    """ Get authentication details to jottacloud.

    Will first check environment variables, then the .netrc file.
    """
    env_username = os.environ.get('JOTTACLOUD_USERNAME')
    env_password = os.environ.get('JOTTACLOUD_PASSWORD')
    netrc_auth = None
    try:
        netrc_file = netrc.netrc()
        netrc_auth = netrc_file.authenticators('jottacloud.com')
    except IOError:
        # .netrc file doesn't exist
        pass
    netrc_username = None
    netrc_password = None
    if netrc_auth:
        netrc_username, _, netrc_password = netrc_auth
    username = env_username or netrc_username
    password = env_password or netrc_password
    if not (username and password):
        raise JFSError('Could not find username and password in either env or ~/.netrc, '
            'you need to add one of these to use these tools')
    return (username, password)