Example #1
0
def run():
    login_ok = False
    login_error = ""

    session = LeapSession()

    try:
        login_ok = session.try_login(leap_user, leap_pass)
    except Exception:
        login_error = sys.exc_info()[0]

    state = StateMgmt()
    formatter = ResultsFormatter()

    if login_ok:
        card = session.get_card_overview()
        events = session.get_events()

        state.dump_state(card, events)
        formatter.print_output(card, events, True, session.login_url())
    else:
        loaded_state = state.load_state()
        if loaded_state is not None:
            formatter.print_output(loaded_state[0], loaded_state[1], False,
                                   session.login_url())
        else:
            formatter.print_error_message(login_error, session.login_url())
Example #2
0
def run():
    login_ok= False
    login_error = ""

    session = LeapSession()

    try:
        login_ok = session.try_login(leap_user, leap_pass)
    except Exception:
        login_error = sys.exc_info()[0]

    state = StateMgmt()
    formatter = ResultsFormatter()

    if login_ok:
        card = session.get_card_overview()
        events = session.get_events()
        
        state.dump_state(card,events)
        formatter.print_output(card,events,True, session.login_url())
    else:
        loaded_state = state.load_state()
        if loaded_state is not None:
            formatter.print_output(loaded_state[0],loaded_state[1],False, session.login_url())
        else:
            formatter.print_error_message(login_error, session.login_url())
Example #3
0
def get_leap_balance(username, password):
    try:
        session = LeapSession()
        session.try_login(username, password)
        overview = session.get_card_overview()
        leap_balance = overview.balance
        # print(leap_balance)
        return leap_balance
    except IOError:
        return False