In below program I am trying to send sms to selected numbers . Numbers are selected from a table using sql query which is then store in pr . In a payload ,instead of putting numbers directly I want to use pr one by one to send sms .But in that case it shows number is missing.is there any way to do.
import sqlite3
import requests
conn=sqlite3.connect("Face.db")
cmd="select mnumber from peoples where presence=1"
cursor=conn.execute(cmd)
for row in cursor:
pr=int(row[0])
url = "https://www.fast2sms.com/dev/bulk"
payload = "sender_id=FSTSMS & message=good morning & language=english & route=p & numbers=pr"
headers = {
'authorization': "zg6YJqFs2wCbPGM9H5p4QOiDlSAca7KvIhWrLxNmEX0RoVBdkefWOGmNVHeR9d6lM8Kzn07gQPBhusFU",
'Content-Type': "application/x-www-form-urlencoded",
'Cache-Control': "no-cache",
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
conn.commit()
conn.close()