def send_insult(sender, recipient): insult = get_insult() + "\nLove,\n" + sender for r in recipient: for p in People.insultPeople: if p.name == r: sendSMS.send(insult, p) break
def check_alert_format(sender, email_info): if (email_info[0] in mbtaJsonParse.stationConverter) and \ (email_info[1] == "Northbound" or email_info[1] == "Southbound") and \ (":" in email_info[2]) and (0 < int(email_info[3]) < 60): return True else: msg = "Incorrect Alert Format. Please check spelling and try again" s = People.person_grab(sender) sendSMS.send(msg, s) return False
def send_help(sender): for p in People.allPeople: if p.name == sender: help_info = "Terrace Raspberry Pi Help\n\n" \ "(To create a custom alert)\n" \ "Subject- alert\n" \ "Body- Station Direction time distance\n\n" \ "(To send an Insult)\n" \ "Subject- insult\n" \ "Body- Name" sendSMS.send(help_info, p)
def send_message(): print("\n===============" "\nWelcome to SMS." "\n===============") to = input("\nTo: ") search_results = cursor.execute("SELECT * FROM contacts WHERE name = (?)", (to, )).fetchall() list_of_names = [] list_of_numbers = [] for i in range(0, search_results.__len__()): list_of_names.append(search_results[i][0]) if list_of_names.__contains__(to): if list_of_names.count(to) > 1: print(">> Multiple {}s were found.\n".format(to)) for some in search_results: print(some) numbers = cursor.execute( "SELECT number FROM contacts WHERE name = (?)", (to, )).fetchall() for items in numbers: for number in items: list_of_numbers.append(number) target_number = int( input( '\nEnter the number of the {} contact that you wish to text: ' .format(to))) if target_number not in list_of_numbers: print(">> Number doesn't match any of the contacts.") proceed() else: message = input("Message: ") sendSMS.send(target_number, message) print("\nYour message to {} has been sent.".format(to)) proceed() else: message = input("Message: ") number = cursor.execute( "SELECT number FROM contacts WHERE name = (?)", (to, )).fetchone()[0] sendSMS.send(number, message) print("\nYour message to {} has been sent.".format(to)) proceed() else: print(">> {} not found.".format(to)) proceed()
def sendLink(): i=0 j=0 send=0 if count1 == 0: L_canvSend.config(text="please select users", fg='red') L_canvSend.update_idletasks() else: path = askdirectory() fd = open('%s/sendLog_%s' % (path, datetime.datetime.now().date()), "w") for user in userPhoneNumbers: if arr[i].get() == 1: PhoneNumber = user #userNameSIP = user + '@' + domain #password = user.Details.Password org = orgLink(list.get()) #IPserver=IP_in_out.options(getServers_id_ip(user)) msg = "Download from here: " + org success = sendSMS.send(api_key, api_secret, PhoneNumber, msg) send = send + success if success==1: fd.write(details[i].displayName.encode('utf-8')+' yes\n') else: fd.write(details[i].displayName.encode('utf-8') + ' no\n') L_canvSend.config(text="send %s/%s " % (j + 1, count1), fg='black') L_canvSend.update_idletasks() j = j + 1 i = i + 1 L_canvSend.config(text="success %s/%s " % (send, count1), fg='black') L_canvSend.update_idletasks() fd.close()
def sendBoth(): global encode i = 0 j = 0 send = 0 if count1 == 0: L_canvSend.config(text="please select users", fg='red') L_canvSend.update_idletasks() else: path = askdirectory() fd = open('%s/sendLog_%s' % (path, datetime.datetime.now().date()), "w") passEncode = encode.get() for user in users: if arr[i].get() == 1: PhoneNumber = user.UserPhoneDetails.PhoneNumber userNameSIP = user.ClientIdentifierList.ClientIdentifier[ 0].Details.Value password = user.Details.Password # org = orgLink(list.get()) IPserver = IP_in_out.options(getServers_id_ip(user)) org = orgLink(list.get()) # IPserver=IP_in_out.options(getServers_id_ip(user)) if passEncode == 1: msg = 'getwml.aspx?uname=' + userNameSIP + '&passs=' + base64.b64encode( password) + '&server=' + IPserver + "&url=" + org else: msg = 'getwml.aspx?uname=' + userNameSIP + '&pass='******'&server=' + IPserver + "&url=" + org success = sendSMS.send(api_key, api_secret, PhoneNumber, msg) send = send + success if success == 1: fd.write( user.Details.DisplayName.encode('utf-8') + ' yes\n') else: fd.write( user.Details.DisplayName.encode('utf-8') + ' no\n') L_canvSend.config(text="send %s/%s " % (j + 1, count1), fg='black') L_canvSend.update_idletasks() j = j + 1 i = i + 1 L_canvSend.config(text="success %s/%s " % (send, count1), fg='black') L_canvSend.update_idletasks() fd.close()
def sendBoth(): global encode i = 0 j = 0 send = 0 if count1 == 0: L_canvSend.config(text="please select users", fg='red') L_canvSend.update_idletasks() else: path = askdirectory() fd = open('%s/sendLog_%s' % (path, datetime.datetime.now().date()), "w") passEncode = encode.get() for check in checkButtonUser: if arrUser[i].get() == 1: user = getUserDetails(arrUserId[i]) PhoneNumber = user[1] userNameSIP = user[2] password = user[3] # org = orgLink(list.get()) IPserver = IP_in_out.options(user[4]) org = orgLink(list.get()) if passEncode == 1: msg = 'getwml.aspx?uname=' + userNameSIP + '&passs=' + base64.b64encode( password) + '&server=' + IPserver + "&url=" + org else: msg = 'getwml.aspx?uname=' + userNameSIP + '&pass='******'&server=' + IPserver + "&url=" + org success = sendSMS.send(api_key, api_secret, PhoneNumber, msg) send = send + success if success == 1: fd.write(user[0].encode('utf-8') + ' yes\n') else: fd.write(user[0].encode('utf-8') + ' no\n') L_canvSend.config(text="send %s/%s " % (j + 1, count1), fg='black') L_canvSend.update_idletasks() j = j + 1 i = i + 1 L_canvSend.config(text="success %s/%s " % (send, count1), fg='black') L_canvSend.update_idletasks() fd.close()
def sendDetails(): global encode i = 0 j = 0 send=0 if count1==0: L_canvSend.config(text="please select users", fg='red') L_canvSend.update_idletasks() else: path = askdirectory() fd = open('%s/sendLog_%s' %(path,datetime.datetime.now().date()), "w") passEncode = encode.get() for user in users: if arr[i].get() == 1: PhoneNumber = user[1] userNameSIP = user[2] password = user[3] #IPserver=IP_in_out.options(user[3]) IPserver = user[4] if passEncode==1: msg = 'getwml.aspx?uname=' + userNameSIP + '&passs=' + base64.b64encode(password) + '&server=' + IPserver else: msg = 'getwml.aspx?uname=' + userNameSIP + '&pass='******'&server=' + IPserver #msg2 = userName.decode('UTF-8') + userNameSIP + "\n"+passw.decode('UTF-8') + password + "\n"+server.decode('UTF-8') + IPserver + "\n end" success = sendSMS.send(api_key, api_secret, PhoneNumber, msg) if success==1: fd.write(user[0]+' yes\n') else: fd.write(user[0] + ' no\n') send = send + success L_canvSend.config(text="send %s/%s " % (j + 1, count1), fg='black') L_canvSend.update_idletasks() j = j + 1 i = i + 1 L_canvSend.config(text="success %s/%s " % (send, count1), fg='black') L_canvSend.update_idletasks() fd.close()