Last active
September 28, 2016 07:28
-
-
Save erdimeola/27647bf0bb9903e9ae73e00ad2b5f083 to your computer and use it in GitHub Desktop.
Bulutfon SMS Gönderme
This file contains 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, json | |
class BulutfonClient(object): | |
def __init__(self, key, sms_title): | |
self.key = key | |
self.sms_title = sms_title | |
self.SMS_ENDPOINT = "https://api.bulutfon.com/messages" | |
def send_transactional_sms(self, to_number, text): | |
data = { | |
"access_token" : self.key, | |
"title" : self.SMS_TITLE, | |
"receivers" : to_number, | |
"content" : text | |
} | |
response = requests.post(self.SMS_ENDPOINT, data=data) | |
result = json.loads(response.content) | |
if result.get("success") == True: | |
return True | |
else: | |
return False | |
client = BulutfonClient("API MASTER KEY", "SMS TITLE") | |
result = client.send_transactional_sms("Numara","Mesaj") | |
if result: | |
print "SMS Başarılı" | |
else: | |
print "SMS Başarısız" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment