| Line 32... |
Line 32... |
| 32 |
timeCondition = datetime.now()-timedelta(hours=2)
|
32 |
timeCondition = datetime.now()-timedelta(hours=2)
|
| 33 |
eligibleSmsNotficationCampaigns = list(get_mongo_connection(host=mongoHost).User.notificationcampaigns.find({'smsprocessed':1,'created':{'$lte':to_java_date(timeCondition)}}))
|
33 |
eligibleSmsNotficationCampaigns = list(get_mongo_connection(host=mongoHost).User.notificationcampaigns.find({'smsprocessed':1,'created':{'$lte':to_java_date(timeCondition)}}))
|
| 34 |
for notificationCampaign in eligibleSmsNotficationCampaigns:
|
34 |
for notificationCampaign in eligibleSmsNotficationCampaigns:
|
| 35 |
logging.debug('Notification_Campign_Id:- '+str(notificationCampaign.get('_id')))
|
35 |
logging.debug('Notification_Campign_Id:- '+str(notificationCampaign.get('_id')))
|
| 36 |
|
36 |
|
| 37 |
jsonSentList = list(get_mongo_connection(host=mongoHost).User.pushnotificationsnew.find({'notification_campaign_id':notificationCampaign.get('_id'),'smstype':'SMS_SENT_OPERATOR'}))
|
37 |
jsonSentList = list(get_mongo_connection(host=mongoHost).User.pushnotificationsnew.find({'notification_campaign_id':str(notificationCampaign.get('_id')),'smstype':'SMS_SENT_OPERATOR'}))
|
| 38 |
|
38 |
|
| 39 |
for smsResponse in jsonSentList:
|
39 |
for smsResponse in jsonSentList:
|
| 40 |
del_det_params = {'user' : 'srlsaholicP', 'password' : 'srp8oct' , 'apimsgid' : smsResponse.get('sms_id')}
|
40 |
del_det_params = {'user' : 'srlsaholicP', 'password' : 'srp8oct' , 'apimsgid' : smsResponse.get('sms_id')}
|
| 41 |
encoded_del_det_params = urllib.urlencode(del_det_params)
|
41 |
encoded_del_det_params = urllib.urlencode(del_det_params)
|
| 42 |
del_det_url = 'http://103.15.179.45:8085/MessagingGateway/http/querymsg?' + encoded_del_det_params
|
42 |
del_det_url = 'http://103.15.179.45:8085/MessagingGateway/http/querymsg?' + encoded_del_det_params
|
| Line 66... |
Line 66... |
| 66 |
except Exception as e:
|
66 |
except Exception as e:
|
| 67 |
logging.debug('Error while getting response for message id:- '+ str(smsResponse.get("sms_id")))
|
67 |
logging.debug('Error while getting response for message id:- '+ str(smsResponse.get("sms_id")))
|
| 68 |
traceback.print_exc()
|
68 |
traceback.print_exc()
|
| 69 |
continue
|
69 |
continue
|
| 70 |
|
70 |
|
| 71 |
jsonSentList = list(get_mongo_connection(host=mongoHost).User.pushnotificationsnew.find({'notification_campaign_id':notificationCampaign.get('_id'),'smstype':'SMS_INPROCESS'}))
|
71 |
jsonSentList = list(get_mongo_connection(host=mongoHost).User.pushnotificationsnew.find({'notification_campaign_id':str(notificationCampaign.get('_id')),'smstype':'SMS_INPROCESS'}))
|
| 72 |
|
72 |
|
| 73 |
for smsResponse in jsonSentList:
|
73 |
for smsResponse in jsonSentList:
|
| 74 |
del_det_params = {'uname' : 'srlsaholic', 'passwd' : 'sr18mar' , 'messageid' : str(smsResponse.get('sms_id'))}
|
74 |
del_det_params = {'uname' : 'srlsaholic', 'passwd' : 'sr18mar' , 'messageid' : str(smsResponse.get('sms_id'))}
|
| 75 |
encoded_del_det_params = urllib.urlencode(del_det_params)
|
75 |
encoded_del_det_params = urllib.urlencode(del_det_params)
|
| 76 |
del_det_url = 'http://103.15.179.45:8085/SMSGateway/getApiReport?' + encoded_del_det_params
|
76 |
del_det_url = 'http://103.15.179.45:8085/SMSGateway/getApiReport?' + encoded_del_det_params
|