Subversion Repositories SmartDukaan

Rev

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

Rev 20372 Rev 21135
Line 9... Line 9...
9
from email.mime.multipart import MIMEMultipart
9
from email.mime.multipart import MIMEMultipart
10
from dtr.utils.utils import fetchResponseUsingProxy, get_mongo_connection, ungzipResponse
10
from dtr.utils.utils import fetchResponseUsingProxy, get_mongo_connection, ungzipResponse
11
import json
11
import json
12
import urllib
12
import urllib
13
import chardet
13
import chardet
-
 
14
from shop2020.utils.EmailAttachmentSender import get_attachment_part
-
 
15
from shop2020.utils import EmailAttachmentSender
14
 
16
 
15
 
17
 
16
con = None
18
con = None
17
parser = optparse.OptionParser()
19
parser = optparse.OptionParser()
18
parser.add_option("-m", "--m", dest="mongoHost",
20
parser.add_option("-m", "--m", dest="mongoHost",
Line 176... Line 178...
176
        except:
178
        except:
177
            continue
179
            continue
178
    message+="""</tbody></table></body></html>"""
180
    message+="""</tbody></table></body></html>"""
179
    print message
181
    print message
180
    #recipients = ['amit.gupta@saholic.com']
182
    #recipients = ['amit.gupta@saholic.com']
181
    recipients = ['rajneesh.arora@saholic.com', 'khushal.bhatia@saholic.com', 'kshitij.sood@saholic.com','chaitnaya.vats@saholic.com','ritesh.chauhan@saholic.com','amit.gupta@saholic.com']
183
    recipients = ['kshitij.sood@saholic.com','ritesh.chauhan@saholic.com','aishwarya.singh@saholic.com']
182
    msg = MIMEMultipart()
-
 
183
    msg['Subject'] = "HomeShop18 Best Sellers" + ' - ' + str(datetime.now())
184
    EmailAttachmentSender.mail_send_grid("dtr@profitmandi.com","apikey", "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", recipients, "Homeshop18 Best Sellers",message ,[],[],[])              
184
    msg['From'] = ""
-
 
185
    msg['To'] = ",".join(recipients)
-
 
186
    msg.preamble = "HomeShop18 Best Sellers" + ' - ' + str(datetime.now())
-
 
187
    html_msg = MIMEText(message, 'html')
-
 
188
    msg.attach(html_msg)
-
 
189
    
185
   
190
    smtpServer = smtplib.SMTP('localhost')
-
 
191
    smtpServer.set_debuglevel(1)
-
 
192
    sender = 'dtr@shop2020.in'
-
 
193
    try:
-
 
194
        smtpServer.sendmail(sender, recipients, msg.as_string())
-
 
195
        print "Successfully sent email"
-
 
196
    except:
-
 
197
        print "Error: unable to send email."
-
 
198
    
186
    
199
def main():
187
def main():
200
    #getCsrfValue()
188
    #getCsrfValue()
201
    scrapeBestSellerMobiles()
189
    scrapeBestSellerMobiles()
202
    if len(bestSellers) > 0:
190
    if len(bestSellers) > 0: