Skip to content

Instantly share code, notes, and snippets.

@amyonsun
Last active July 9, 2021 21:34
Show Gist options
  • Save amyonsun/4d97f3368b6394f8139b1c435087abac to your computer and use it in GitHub Desktop.
Save amyonsun/4d97f3368b6394f8139b1c435087abac to your computer and use it in GitHub Desktop.
Send SMS via Raygansms.com API
import requests
import urllib.parse
def send_sms_with_raygansms_via_get_method(phone_number, message):
try:
url = 'https://raygansms.com/SendMessageWithUrl.ashx?'
parametrs = {
'UserName': '<username>',
'Password': '<password>',
'PhoneNumber': '<operator number>',
'MessageBody': message,
'RecNumber': phone_number,
'Smsclass': 1
}
url += urllib.parse.urlencode(parametrs)
response = requests.get(url)
return [0, response.text]
except Exception as error:
return [1, str(error)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment