| Line 59... |
Line 59... |
| 59 |
|
59 |
|
| 60 |
sentSmsUsers = []
|
60 |
sentSmsUsers = []
|
| 61 |
smsResponseIdMap = {}
|
61 |
smsResponseIdMap = {}
|
| 62 |
payloadList = []
|
62 |
payloadList = []
|
| 63 |
|
63 |
|
| 64 |
|
64 |
smstext = str(notificationCampaign.messagetext) + ' http://bit.ly/1LBesWK'
|
| 65 |
for user in allUsers:
|
65 |
for user in allUsers:
|
| 66 |
if user.mobile_number is not None and len(user.mobile_number)==10 and user.mobile_number not in sentSmsUsers:
|
66 |
if user.mobile_number is not None and len(user.mobile_number)==10 and user.mobile_number not in sentSmsUsers:
|
| 67 |
#url_params = { 'Mobile' : '91'+user.mobile_number, 'Username' : 'srlsaholicP', 'Password' : 'srp8oct' , 'MessageType' : 'txt', 'SenderID' : '090000', 'Message' : notificationCampaign.messagetext }
|
67 |
#url_params = { 'Mobile' : '91'+user.mobile_number, 'Username' : 'srlsaholicP', 'Password' : 'srp8oct' , 'MessageType' : 'txt', 'SenderID' : '090000', 'Message' : notificationCampaign.messagetext }
|
| 68 |
url_params = { 'Mobile' : '91'+user.mobile_number, 'Username' : 'srlsaholicP', 'Password' : 'srp8oct' , 'MessageType' : 'txt', 'SenderID' : '090000', 'Message' : notificationCampaign.messagetext }
|
68 |
url_params = { 'Mobile' : '91'+user.mobile_number, 'Username' : 'srlsaholicP', 'Password' : 'srp8oct' , 'MessageType' : 'txt', 'SenderID' : '090000', 'Message' : smstext }
|
| 69 |
encoded_url_params = urllib.urlencode(url_params)
|
69 |
encoded_url_params = urllib.urlencode(url_params)
|
| 70 |
url = PROMOTIONAL_SMS_SEND_URL + encoded_url_params
|
70 |
url = PROMOTIONAL_SMS_SEND_URL + encoded_url_params
|
| 71 |
print url
|
71 |
print url
|
| 72 |
response_str = None
|
72 |
response_str = None
|
| 73 |
try:
|
73 |
try:
|
| Line 134... |
Line 134... |
| 134 |
del_response = urllib2.urlopen(del_req)
|
134 |
del_response = urllib2.urlopen(del_req)
|
| 135 |
del_response_str = del_response.read()
|
135 |
del_response_str = del_response.read()
|
| 136 |
print del_response_str
|
136 |
print del_response_str
|
| 137 |
if 'STATUS' in del_response_str:
|
137 |
if 'STATUS' in del_response_str:
|
| 138 |
status = del_response_str.split(' ')[3]
|
138 |
status = del_response_str.split(' ')[3]
|
| 139 |
|
- |
|
| 140 |
if status=='DELIVRD':
|
139 |
if status=='DELIVRD':
|
| 141 |
status = 'SMS_DELIVRD'
|
140 |
status = 'SMS_DELIVRD'
|
| 142 |
elif status=='SENT':
|
141 |
elif status=='SENT':
|
| 143 |
status = 'SMS_SENT_OPERATOR'
|
142 |
status = 'SMS_SENT_OPERATOR'
|
| 144 |
elif status=='REJECTD' or status== 'FAILED':
|
143 |
elif status=='REJECTD' or status== 'FAILED':
|
| Line 151... |
Line 150... |
| 151 |
payload = {}
|
150 |
payload = {}
|
| 152 |
payload["user_id"]= userId
|
151 |
payload["user_id"]= userId
|
| 153 |
payload["type"]=status
|
152 |
payload["type"]=status
|
| 154 |
payload["notification_campaign_id"]= notificationCampaign.id
|
153 |
payload["notification_campaign_id"]= notificationCampaign.id
|
| 155 |
payload["status"]=1
|
154 |
payload["status"]=1
|
| - |
|
155 |
if status == 'SMS_SENT_OPERATOR':
|
| - |
|
156 |
payload["sms_id"] = msgId
|
| 156 |
|
157 |
|
| 157 |
if len(payloadList)==5000:
|
158 |
if len(payloadList)==5000:
|
| 158 |
jsonObj = json.dumps([dict(pn) for pn in payloadList])
|
159 |
jsonObj = json.dumps([dict(pn) for pn in payloadList])
|
| 159 |
print jsonObj
|
160 |
print jsonObj
|
| 160 |
pushpostrequest = urllib2.Request("http://45.33.50.227:3001/addPushNotification")
|
161 |
pushpostrequest = urllib2.Request("http://45.33.50.227:3001/addPushNotification")
|