Subversion Repositories SmartDukaan

Rev

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

Rev 20370 Rev 21135
Line 8... Line 8...
8
import pymongo
8
import pymongo
9
import re
9
import re
10
import smtplib
10
import smtplib
11
import urllib2
11
import urllib2
12
from dtr.utils.PaytmOfferScraper import fetchOffers
12
from dtr.utils.PaytmOfferScraper import fetchOffers
-
 
13
from shop2020.utils.EmailAttachmentSender import get_attachment_part
-
 
14
from shop2020.utils import EmailAttachmentSender
13
 
15
 
14
con = None
16
con = None
15
parser = optparse.OptionParser()
17
parser = optparse.OptionParser()
16
parser.add_option("-m", "--m", dest="mongoHost",
18
parser.add_option("-m", "--m", dest="mongoHost",
17
                      default="localhost",
19
                      default="localhost",
Line 146... Line 148...
146
        except:
148
        except:
147
            continue
149
            continue
148
    message+="""</tbody></table></body></html>"""
150
    message+="""</tbody></table></body></html>"""
149
    print message
151
    print message
150
    #recipients = ['amit.gupta@saholic.com']
152
    #recipients = ['amit.gupta@saholic.com']
151
    recipients = ['rajneesh.arora@saholic.com','kshitij.sood@saholic.com','chaitnaya.vats@saholic.com', 'khushal.bhatia@saholic.com', 'ritesh.chauhan@saholic.com','amit.gupta@saholic.com']
153
    recipients = ['kshitij.sood@saholic.com','ritesh.chauhan@saholic.com','aishwarya.singh@saholic.com']
152
    msg = MIMEMultipart()
-
 
153
    msg['Subject'] = "Paytm Best Sellers" + ' - ' + str(datetime.now())
154
    EmailAttachmentSender.mail_send_grid("dtr@profitmandi.com","apikey", "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", recipients, "Paytm Best Sellers",message ,[],[],[])              
154
    msg['From'] = ""
155
    
155
    msg['To'] = ",".join(recipients)
-
 
156
    msg.preamble = "Paytm Best Sellers" + ' - ' + str(datetime.now())
-
 
157
    html_msg = MIMEText(message, 'html')
-
 
158
    msg.attach(html_msg)
-
 
159
    
156
    
160
    smtpServer = smtplib.SMTP('localhost')
-
 
161
    smtpServer.set_debuglevel(1)
-
 
162
    sender = 'dtr@shop2020.in'
-
 
163
    try:
-
 
164
        smtpServer.sendmail(sender, recipients, msg.as_string())
-
 
165
        print "Successfully sent email"
-
 
166
    except:
-
 
167
        print "Error: unable to send email."
-
 
168
 
157
 
169
def addExtraAttributes():
158
def addExtraAttributes():
170
    for e in exceptionList:
159
    for e in exceptionList:
171
        url = "https://catalog.paytm.com/v1/mobile/product/%s" %(e.identifier.strip())
160
        url = "https://catalog.paytm.com/v1/mobile/product/%s" %(e.identifier.strip())
172
        try:
161
        try: