Exemplo n.º 1
0
    def get_client(self):
        token = auth.login(self.email, self.password)
        if not token:
            sys.exit('Could not get token from Logitech server.')

        session_token = auth.swap_auth_token(
            self.harmony_ip, self.harmony_port, token)
        if not session_token:
            sys.exit('Could not swap login token for session token.')

        client = harmony_client.create_and_connect_client(
            self.harmony_ip, self.harmony_port, session_token)
        return client
Exemplo n.º 2
0
def login_to_logitech(args):
    """Logs in to the Logitech service.

    Args:
      args: argparse arguments needed to login.

    Returns:
      Session token that can be used to log in to the Harmony device.
    """
    token = auth.login(args.email, args.password)
    if not token:
        sys.exit('Could not get token from Logitech server.')

    session_token = auth.swap_auth_token(
        args.harmony_ip, args.harmony_port, token)
    if not session_token:
        sys.exit('Could not swap login token for session token.')

    return session_token
Exemplo n.º 3
0
def login_to_logitech(args):
    """Logs in to the Logitech service.

    Args:
      args: argparse arguments needed to login.

    Returns:
      Session token that can be used to log in to the Harmony device.
    """
    token = auth.login(args.email, args.password)
    if not token:
        sys.exit('Could not get token from Logitech server.')

    session_token = auth.swap_auth_token(
        args.harmony_ip, args.harmony_port, token)
    if not session_token:
        sys.exit('Could not swap login token for session token.')

    return session_token
Exemplo n.º 4
0
def login_to_logitech(email, password, harmony_ip, harmony_port):
    """Logs in to the Logitech service.

    Args:
        email (str):  Email address used to login to Logitech service
        password (str): Password used to login to Logitech service
        harmony_ip (str): Harmony hub IP address
        harmony_port (str): Harmony hub port

    Returns:
        Session token used to log in to the Harmony device.
    """
    token = harmony_auth.login(email, password)
    if not token:
        logger.warning('Could not get token from Logitech server.')

    session_token = harmony_auth.swap_auth_token(harmony_ip, harmony_port, token)
    if not session_token:
        logger.warning('Could not swap login token for session token.')

    return session_token
Exemplo n.º 5
0
def login_to_logitech(email, password, harmony_ip='HarmonyHub', harmony_port=5222):
    """Logs in to the Logitech service.

    Args:
      email: Email address to login to Logitech
      password: Password to login to Logitech
      harmony_ip: IP address of Harmony Hub
      harmony_port: port of Harmony Hub (default: 5222)

    Returns:
      Session token that can be used to log in to the Harmony device.
    """
    token = auth.login(email, password)
    if not token:
        sys.exit('Could not get token from Logitech server.')

    session_token = auth.swap_auth_token(
        harmony_ip, harmony_port, token)
    if not session_token:
        sys.exit('Could not swap login token for session token.')

    return session_token
Exemplo n.º 6
0
def login_to_logitech(email,
                      password,
                      harmony_ip='HarmonyHub',
                      harmony_port=5222):
    """Logs in to the Logitech service.

    Args:
      email: Email address to login to Logitech
      password: Password to login to Logitech
      harmony_ip: IP address of Harmony Hub
      harmony_port: port of Harmony Hub (default: 5222)

    Returns:
      Session token that can be used to log in to the Harmony device.
    """
    token = auth.login(email, password)
    if not token:
        sys.exit('Could not get token from Logitech server.')

    session_token = auth.swap_auth_token(harmony_ip, harmony_port, token)
    if not session_token:
        sys.exit('Could not swap login token for session token.')

    return session_token
Exemplo n.º 7
0
def ha_get_token(username, password):
    token = harmony_auth.login(username, password)
    return token