-4

I have established a relationship between PostgreSQL and Python. I provide that send e-mail to a user with used Python. I want to send a message to specific user's phone.

I shared a part of my code:

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 2
    Can we see what you have tried? This feels a bit unresearched to me, and we do encourage posters here to try solving their problem first. – halfer Jan 15 '17 at 19:37
  • 2
    Please add the code to your question as text, not an image! It is almost impossible to decipher. Just indent the code four spaces, or select the code an use the '{}' button above the edit box. – Roland Smith Jan 15 '17 at 21:30
  • 4
    No, you didn't share a part of your code. You copied your code into Word, took an extremely low-resolution screenshot, and posted that. **Copy** your code, [edit] your question, **paste** in the code, highlight it, and press the `{ }` code formatting button. – MattDMo Jan 15 '17 at 22:46

2 Answers2

0

You could use the Amazon SNS service (Simple Notification Service). It's a REST service, so it can be used in any language, including Python.

See Using Amazon SNS for User Notifications with a Mobile Phone Number as a Subscriber (Send SMS).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Luis Leal
  • 3,388
  • 5
  • 26
  • 49
0

There are many resources around.

Code

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")
Community
  • 1
  • 1
J.A.K.
  • 115
  • 8