Last active
July 9, 2021 21:34
-
-
Save amyonsun/4d97f3368b6394f8139b1c435087abac to your computer and use it in GitHub Desktop.
Send SMS via Raygansms.com API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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