从python免费短信发送服务?
问题描述:
有没有什么方法可以发送文本消息到客户端的手机使用python,像SMTP一样,或者如何使用免费的短信提供商,如way2sms或雅虎信使向使用Python的近500个客户端发送短信?从python免费短信发送服务?
答
您可以使用它可以发现here.
所以搜索就适应它通过客户端数量的数据库,并有可能使用类似这样的Python SMS API
:
#Python SMS API:
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")
import sqlite3
myDB = sqlite3.connect("Clients.db")
dbCursor = myDB.cursor()
list_of_client_numbers = dbCursor.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)
myDB.close()
total_points = sms.get_points()['points']
print("You have", total_points, "points left")
显然使用的代码和适应因此它适合于您在程序中声明和使用的变量。
答
API代码可用于python。从https://www.gitbook.com/book/itsnew/python-send-sms-integration-with-python/details下载python短信代码和集成为:
sms = sms.send_sms(
recipient="91902000xxxx",
message="test message"
)
请注意:您将需要配置从网关提供商的短信API密钥。
你将如何获得用户名和密码? – thisisshantzz
@thisisshantzz来自https://ssl.smsapi.pl/?lang=en – McLeary