aboutsummaryrefslogtreecommitdiffstats
path: root/servo/messaging
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-10-26 21:48:36 +0200
committerFilipp Lepalaan <filipp@mac.com>2015-10-26 21:48:36 +0200
commit8c2c2faefa7fa93b0146cd4c4439ea38dde875bb (patch)
tree529677a342a0ea7b175ff955eabfa0d012041807 /servo/messaging
parentca22ec71da4c0386885b0997afab02151c9d4388 (diff)
downloadServo-8c2c2faefa7fa93b0146cd4c4439ea38dde875bb.tar.gz
Servo-8c2c2faefa7fa93b0146cd4c4439ea38dde875bb.tar.bz2
Servo-8c2c2faefa7fa93b0146cd4c4439ea38dde875bb.zip
Update SMSApi URLs
Diffstat (limited to 'servo/messaging')
-rw-r--r--servo/messaging/sms.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/servo/messaging/sms.py b/servo/messaging/sms.py
index 55a3d77..7f9535d 100644
--- a/servo/messaging/sms.py
+++ b/servo/messaging/sms.py
@@ -3,11 +3,14 @@
import re
import urllib
from hashlib import md5
+from ssl import _create_unverified_context
+
from django.conf import settings
from django.utils.translation import ugettext as _
from servo.models.common import Configuration
+
class BaseSMSProvider:
def __init__(self, recipient, note, msg):
self.conf = Configuration.conf()
@@ -82,7 +85,6 @@ class SMSJazzProvider:
params['dlruri'] = dlruri
params = urllib.urlencode(params)
- from ssl import _create_unverified_context
r = urllib.urlopen(self.URL, params, context=_create_unverified_context()).read()
if not '1:OK' in r:
@@ -94,13 +96,14 @@ class HQSMSProvider(BaseSMSProvider):
HQSMS Gateway Provider.
API docs: http://www.hqsms.com/media/page/docs/HQSMS_https.pdf
"""
- URL = 'https://ssl.hqsms.com/sms.do'
- BACKUP_URL = 'https://ssl2.hqsms.com/sms.do'
+ URL = "https://api.smsapi.com/sms.do"
+ BACKUP_URL = "https://api2.smsapi.com/sms.do"
ERRORS = {
"ERROR:13" : _("Lack of valid phone numbers (invalid or blacklisted numbers)"),
"ERROR:14" : _("Wrong sender name"),
"ERROR:19" : _("Too many messages in one request"),
+ "ERROR:52" : _("Too many attempts of sending messages to one number (maximum 10 attempts whin 60s)"),
"ERROR:102" : _("Invalid username or password"),
"ERROR:103" : _("Insufficient credits on your account"),
"ERROR:200" : _("Unsuccessful message submission"),
@@ -137,7 +140,6 @@ class HQSMSProvider(BaseSMSProvider):
params['notify_url'] = dlruri
params = urllib.urlencode(params)
- from ssl import _create_unverified_context
r = urllib.urlopen(self.URL, params, context=_create_unverified_context()).read()
if 'ERROR:' in r:
@@ -164,6 +166,5 @@ class HttpProvider:
'to' : number
})
- from ssl import _create_unverified_context
f = urllib.urlopen("%s?%s" % (conf['sms_http_url'], params), context=_create_unverified_context())
return f.read()