[英]How can I send a message to specific users phone by using Python?
I have established a relationship between PostgreSQL and Python.我已经建立了 PostgreSQL 和 Python 之间的关系。 I provide that send e-mail to a user with used Python.
我提供将电子邮件发送给使用 Python 的用户。 I want to send a message to specific user's phone.
我想向特定用户的手机发送消息。
I shared a part of my code:我分享了我的一部分代码:
You could use the Amazon SNS service (Simple Notification Service).您可以使用Amazon SNS服务(简单通知服务)。 It's a REST service, so it can be used in any language, including Python.
它是一种 REST 服务,因此可以在任何语言中使用,包括 Python。
See Using Amazon SNS for User Notifications with a Mobile Phone Number as a Subscriber (Send SMS) .请参阅 使用 Amazon SNS 以手机号码作为订阅者的用户通知(发送 SMS) 。
There are many 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")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.