def send_sms_to_contact_no(contact_no, full_msg): msg_chunks = break_msg_into_chunks(full_msg) for chunk_no, chunk in enumerate(msg_chunks): print '\tSending SMS Chunk Number: ' + str(chunk_no+1) + ' ...' is_sent_flag = False while is_sent_flag == False: try: if len(msg_chunks) == 1: send_sms(contact_no, chunk) else: send_sms(contact_no, append_footer_to_msg(chunk, chunk_no, len(msg_chunks))) is_sent_flag = True except SessionExpired: props = ConfigProps(PROPERTIES_FILE_NAME, expectedPropList) login_to_way2sms(props.get_way2sms_username(), props.get_way2sms_password())
to_send_matched_contacts = get_matched_contacts_from_user(to_add_contact_name) for matched_contact in to_send_matched_contacts: new_to_send.append(matched_contact) else: print 'Empty string contact name search not allowed!!' return new_to_send if __name__ == '__main__': if len(sys.argv) == 2: props = ConfigProps(PROPERTIES_FILE_NAME, expectedPropList) argv1 = sys.argv[1] to_send_contacts = get_matched_contacts_from_user(argv1) if len(to_send_contacts) == 0: print 'No Contacts to send, Exiting.. ' sys.exit() login_to_way2sms(props.get_way2sms_username(), props.get_way2sms_password()) while 1: if len(to_send_contacts) == 0: print 'No Contacts to send, Exiting.. ' sys.exit() message = get_message_from_user(to_send_contacts) if message == None: if (ask_if_confirm_exit() == True): break else: continue elif message.lower() == 'd': to_send_contacts = remove_some_from_to_send(to_send_contacts) if (len(to_send_contacts) == 0): if (ask_if_confirm_exit() == False): to_send_contacts = add_some_more_to_send(to_send_contacts)