如何使用Python向特定用户手机发送消息?

时间:2017-01-15 19:33:39

标签: python sendmessage

我已经在Postgresql和Python之间建立了关系。我提供了使用Python发送电子邮件给用户。我想向特定用户的手机发送消息。

我分享了我的部分代码。

enter image description here

2 个答案:

答案 0 :(得分:0)

您可以使用Amazon SMS服务,它是一个休息服务,因此可以使用任何语言,包括python http://docs.aws.amazon.com/sns/latest/dg/SMSMessages.html

答案 1 :(得分:0)

Try Google There's Lots of Resources Around

from smsapi import SmsApi
username = "USERNAME"
password = "PASSWORD"

sms = SmsApi(username, password)

total_points = sms.get_points()['points']
print("You have", total_points, "points left")

cursor = conn.cursor()

list_of_client_numbers = cursor.execute('''SELECT mobNumber FROM clientsTable''')

for eachRecord in list_of_client_numbers:
    sms = sms.send_sms(
          recipient=eachRecord,
          sender_name="YOUR COMPANY NAME",
          message="MESSAGE",
          eco=False)

conn.close()

total_points = sms.get_points()['points'] print("You have", total_points, "points left")