0% found this document useful (0 votes)
126 views

Python Send SMS

This document provides code snippets for sending SMS messages using the way2sms and fast2sms APIs. The way2sms code requires creating an API key, then making a GET request with login credentials, the API key, message text, and recipient number. The fast2sms code makes a POST request with sender ID, message text, language, route, and recipient numbers as payload, along with an authorization header. Both APIs are limited to approximately 20 SMS per day.

Uploaded by

vsnpradeep
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views

Python Send SMS

This document provides code snippets for sending SMS messages using the way2sms and fast2sms APIs. The way2sms code requires creating an API key, then making a GET request with login credentials, the API key, message text, and recipient number. The fast2sms code makes a POST request with sender ID, message text, language, route, and recipient numbers as payload, along with an authorization header. Both APIs are limited to approximately 20 SMS per day.

Uploaded by

vsnpradeep
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

To send sms using way2sms account, you may use below code snippet.

Before that you would be required to create an API Key from here


import requests
url = "https://smsapi.engineeringtgr.com/send/"
params = dict(
Mobile='login username',
Password='login password',
Key='generated from above sms api',
Message='Your message Here',
To='recipient')

resp = requests.get(url, params)


print(resp, resp.text)
N.B: There is a limit of approx 20 sms per day

import requests

url = "https://www.fast2sms.com/dev/bulk"

payload = "sender_id=FSTSMS&message=Good morning , this is prasad sending from


python.&language=english&route=p&numbers=9052766763,7013514480"

headers = {

'authorization': "your app key",

'Content-Type': "application/x-www-form-urlencoded",

'Cache-Control': "no-cache",

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)

You might also like