Subversion Repositories SmartDukaan

Rev

Rev 17398 | Rev 17452 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17398 Rev 17400
Line 15... Line 15...
15
import json
15
import json
16
import time
16
import time
17
import traceback
17
import traceback
18
import logging
18
import logging
19
 
19
 
20
PUSH_NOTIFICATIONS_DETAILS_URL="http://45.33.50.227:3001/getPushNotificationDetailsByType/?type=%s&notification_campaign_id=%d&status=%s"
20
PUSH_NOTIFICATIONS_DETAILS_URL="http://localhost:3001/getPushNotificationDetailsByType/?type=%s&notification_campaign_id=%d&status=%s"
21
PROMOTIONAL_SMS_SEND_URL = "http://103.15.179.45:8085/MessagingGateway/SendTransSMS?"
21
PROMOTIONAL_SMS_SEND_URL = "http://103.15.179.45:8085/MessagingGateway/SendTransSMS?"
22
#ID is: PRO02135496 Mobile Number is: 918512809859 PRO02135496#SMS Sent successfully to : 918512809859
22
#ID is: PRO02135496 Mobile Number is: 918512809859 PRO02135496#SMS Sent successfully to : 918512809859
23
#http://103.15.179.45:8085/MessagingGateway/http/querymsg?user=srlsaholicP&password=srp8oct&apimsgid=PRO02257518
23
#http://103.15.179.45:8085/MessagingGateway/http/querymsg?user=srlsaholicP&password=srp8oct&apimsgid=PRO02257518
24
#MessageID: PRO02135496 STATUS: DELIVRD ErrorCode: 0 DR Time: 2015-10-20 18:05:11 
24
#MessageID: PRO02135496 STATUS: DELIVRD ErrorCode: 0 DR Time: 2015-10-20 18:05:11 
25
 
25
 
Line 92... Line 92...
92
                payload["notification_campaign_id"]= notificationCampaign.id
92
                payload["notification_campaign_id"]= notificationCampaign.id
93
                payload["status"]=1
93
                payload["status"]=1
94
                
94
                
95
                if len(payloadList)==5000:
95
                if len(payloadList)==5000:
96
                    jsonObj = json.dumps([dict(pn) for pn in payloadList])
96
                    jsonObj = json.dumps([dict(pn) for pn in payloadList])
97
                    pushpostrequest = urllib2.Request("http://45.33.50.227:3001/addPushNotification")
97
                    pushpostrequest = urllib2.Request("http://localhost:3001/addPushNotification")
98
                    pushpostrequest.add_header('Content-Type', 'application/json')
98
                    pushpostrequest.add_header('Content-Type', 'application/json')
99
                    response = urllib2.urlopen(pushpostrequest, jsonObj).read()
99
                    response = urllib2.urlopen(pushpostrequest, jsonObj).read()
100
                    payloadList = []
100
                    payloadList = []
101
                
101
                
102
                payloadList.append(payload)
102
                payloadList.append(payload)
Line 159... Line 159...
159
                    if status == 'SMS_SENT_OPERATOR':
159
                    if status == 'SMS_SENT_OPERATOR':
160
                        payload["sms_id"] = msgId
160
                        payload["sms_id"] = msgId
161
                    
161
                    
162
                    if len(payloadList)==5000:
162
                    if len(payloadList)==5000:
163
                        jsonObj = json.dumps([dict(pn) for pn in payloadList])
163
                        jsonObj = json.dumps([dict(pn) for pn in payloadList])
164
                        pushpostrequest = urllib2.Request("http://45.33.50.227:3001/addPushNotification")
164
                        pushpostrequest = urllib2.Request("http://localhost:3001/addPushNotification")
165
                        pushpostrequest.add_header('Content-Type', 'application/json')
165
                        pushpostrequest.add_header('Content-Type', 'application/json')
166
                        response = urllib2.urlopen(pushpostrequest, jsonObj).read()
166
                        response = urllib2.urlopen(pushpostrequest, jsonObj).read()
167
                        payloadList = []
167
                        payloadList = []
168
                    payloadList.append(payload)
168
                    payloadList.append(payload)
169
                
169
                
Line 171... Line 171...
171
                logging.debug('Error while getting response for message id:- '+ msgId)
171
                logging.debug('Error while getting response for message id:- '+ msgId)
172
                traceback.print_exc()
172
                traceback.print_exc()
173
                continue
173
                continue
174
            
174
            
175
        jsonObj = json.dumps([dict(pn) for pn in payloadList])
175
        jsonObj = json.dumps([dict(pn) for pn in payloadList])
176
        pushpostrequest = urllib2.Request("http://45.33.50.227:3001/addPushNotification")
176
        pushpostrequest = urllib2.Request("http://localhost:3001/addPushNotification")
177
        pushpostrequest.add_header('Content-Type', 'application/json')
177
        pushpostrequest.add_header('Content-Type', 'application/json')
178
        response = urllib2.urlopen(pushpostrequest, jsonObj).read()
178
        response = urllib2.urlopen(pushpostrequest, jsonObj).read()
179
        
179
        
180
        logging.debug('Total Sms Sent:- '+str(len(sentSmsUsers)))
180
        logging.debug('Total Sms Sent:- '+str(len(sentSmsUsers)))
181
        
181