Open In App

Send SMS with REST Using Python

In this article, we are going to see how we can send SMS with REST using Python. The requests library can be used to make REST requests using Python to send SMS. 

Approach:

Following are the parameters used in GET API:

Below is the implementation:




import requests
  
  
querystring = {
    "authorization": "API_KEY_OF_YOURS",
    "message": "This is test Message sent from \
         Python Script using REST API.",
    "language": "english",
    "route": "q",
    "numbers": "XXXXXXXX98, YYYYYYYY89"}
  
headers = {
    'cache-control': "no-cache"
}
try:
    response = requests.request("GET", url,
                                headers = headers,
                                params = querystring)
      
    print("SMS Successfully Sent")
except:
    print("Oops! Something wrong")

Output:

SMS Successfully Sent

Message sent using REST in Python

Article Tags :