| Line 22... |
Line 22... |
| 22 |
import smtplib
|
22 |
import smtplib
|
| 23 |
from email import encoders
|
23 |
from email import encoders
|
| 24 |
from email.mime.text import MIMEText
|
24 |
from email.mime.text import MIMEText
|
| 25 |
from email.mime.base import MIMEBase
|
25 |
from email.mime.base import MIMEBase
|
| 26 |
from email.mime.multipart import MIMEMultipart
|
26 |
from email.mime.multipart import MIMEMultipart
|
| - |
|
27 |
import email.encoders
|
| 27 |
|
28 |
|
| 28 |
|
29 |
|
| 29 |
|
30 |
|
| 30 |
config_client = ConfigClient()
|
31 |
config_client = ConfigClient()
|
| 31 |
host = config_client.get_property('staging_hostname')
|
32 |
host = config_client.get_property('staging_hostname')
|
| Line 1102... |
Line 1103... |
| 1102 |
try:
|
1103 |
try:
|
| 1103 |
#EmailAttachmentSender.mail("build@shop2020.in", "cafe@nes", ["kshitij.sood@saholic.com"], " Snapdeal Auto Pricing "+runType+" " + str(timestamp), "", [get_attachment_part(filename)], [""], [])
|
1104 |
#EmailAttachmentSender.mail("build@shop2020.in", "cafe@nes", ["kshitij.sood@saholic.com"], " Snapdeal Auto Pricing "+runType+" " + str(timestamp), "", [get_attachment_part(filename)], [""], [])
|
| 1104 |
EmailAttachmentSender.mail("build@shop2020.in", "cafe@nes", ["chandan.kumar@saholic.com","manoj.kumar@saholic.com","yukti.jain@saholic.com","ankush.dhingra@saholic.com","manoj.pal@saholic.com"], " Snapdeal Auto Pricing "+runType+" " + str(timestamp), "", [get_attachment_part(filename)], ["rajneesh.arora@saholic.com","rajveer.singh@saholic.com","vikram.raghav@saholic.com","kshitij.sood@saholic.com","chaitnaya.vats@saholic.com","khushal.bhatia@saholic.com"], [])
|
1105 |
EmailAttachmentSender.mail("build@shop2020.in", "cafe@nes", ["chandan.kumar@saholic.com","manoj.kumar@saholic.com","yukti.jain@saholic.com","ankush.dhingra@saholic.com","manoj.pal@saholic.com"], " Snapdeal Auto Pricing "+runType+" " + str(timestamp), "", [get_attachment_part(filename)], ["rajneesh.arora@saholic.com","rajveer.singh@saholic.com","vikram.raghav@saholic.com","kshitij.sood@saholic.com","chaitnaya.vats@saholic.com","khushal.bhatia@saholic.com"], [])
|
| 1105 |
except Exception as e:
|
1106 |
except Exception as e:
|
| 1106 |
print e
|
1107 |
print e
|
| - |
|
1108 |
print "Unable to send report.Trying with local SMTP"
|
| - |
|
1109 |
smtpServer = smtplib.SMTP('localhost')
|
| - |
|
1110 |
smtpServer.set_debuglevel(1)
|
| - |
|
1111 |
sender = 'support@shop2020.in'
|
| - |
|
1112 |
#recipients = ['kshitij.sood@saholic.com']
|
| - |
|
1113 |
msg = MIMEMultipart()
|
| - |
|
1114 |
msg['Subject'] = "Snapdeal Auto Pricing" + ' - ' + str(datetime.now())
|
| - |
|
1115 |
msg['From'] = sender
|
| 1107 |
print "Unable to send report"
|
1116 |
recipients = ['rajneesh.arora@saholic.com','rajveer.singh@saholic.com','vikram.raghav@saholic.com','kshitij.sood@saholic.com','khushal.bhatia@saholic.com','chaitnaya.vats@saholic.com','chandan.kumar@saholic.com','manoj.kumar@saholic.com','yukti.jain@saholic.com','ankush.dhingra@saholic.com','manoj.pal@saholic.com']
|
| - |
|
1117 |
msg['Subject'] = "Snapdeal Auto Pricing "+runType+" " + str(timestamp)
|
| - |
|
1118 |
msg['From'] = sender
|
| - |
|
1119 |
msg['To'] = ", ".join(recipients)
|
| - |
|
1120 |
fileMsg = email.mime.base.MIMEBase('application','vnd.ms-excel')
|
| - |
|
1121 |
fileMsg.set_payload(file(filename).read())
|
| - |
|
1122 |
email.encoders.encode_base64(fileMsg)
|
| - |
|
1123 |
fileMsg.add_header('Content-Disposition','attachment;filename=snapdeal.xls')
|
| - |
|
1124 |
msg.attach(fileMsg)
|
| - |
|
1125 |
try:
|
| - |
|
1126 |
smtpServer.sendmail(sender, recipients, msg.as_string())
|
| - |
|
1127 |
print "Successfully sent email"
|
| - |
|
1128 |
except:
|
| - |
|
1129 |
print "Error: unable to send email."
|
| - |
|
1130 |
|
| 1108 |
|
1131 |
|
| 1109 |
def commitExceptionList(exceptionList,timestamp):
|
1132 |
def commitExceptionList(exceptionList,timestamp):
|
| 1110 |
exceptionItems=[]
|
1133 |
exceptionItems=[]
|
| 1111 |
for item in exceptionList:
|
1134 |
for item in exceptionList:
|
| 1112 |
mpHistory = MarketPlaceHistory()
|
1135 |
mpHistory = MarketPlaceHistory()
|
| Line 1345... |
Line 1368... |
| 1345 |
mpHistory.timestamp = timestamp
|
1368 |
mpHistory.timestamp = timestamp
|
| 1346 |
mpHistory.run = RunType._NAMES_TO_VALUES.get(snapdealItemInfo.runType)
|
1369 |
mpHistory.run = RunType._NAMES_TO_VALUES.get(snapdealItemInfo.runType)
|
| 1347 |
buyBoxList.append(mpHistory)
|
1370 |
buyBoxList.append(mpHistory)
|
| 1348 |
session.commit()
|
1371 |
session.commit()
|
| 1349 |
return buyBoxList
|
1372 |
return buyBoxList
|
| - |
|
1373 |
|
| 1350 |
def sendAutoPricingMail(successfulAutoDecrease,successfulAutoIncrease):
|
1374 |
def sendAutoPricingMail(successfulAutoDecrease,successfulAutoIncrease):
|
| 1351 |
xstr = lambda s: s or ""
|
1375 |
xstr = lambda s: s or ""
|
| 1352 |
catalog_client = CatalogClient().get_client()
|
1376 |
catalog_client = CatalogClient().get_client()
|
| 1353 |
inventory_client = InventoryClient().get_client()
|
1377 |
inventory_client = InventoryClient().get_client()
|
| 1354 |
message="""<html>
|
1378 |
message="""<html>
|
| Line 1428... |
Line 1452... |
| 1428 |
mailServer.login("build@shop2020.in", "cafe@nes")
|
1452 |
mailServer.login("build@shop2020.in", "cafe@nes")
|
| 1429 |
#mailServer.sendmail("cafe@nes", ['kshitij.sood@saholic.com'], msg.as_string())
|
1453 |
#mailServer.sendmail("cafe@nes", ['kshitij.sood@saholic.com'], msg.as_string())
|
| 1430 |
mailServer.sendmail("cafe@nes", recipients, msg.as_string())
|
1454 |
mailServer.sendmail("cafe@nes", recipients, msg.as_string())
|
| 1431 |
except Exception as e:
|
1455 |
except Exception as e:
|
| 1432 |
print e
|
1456 |
print e
|
| - |
|
1457 |
print "Unable to send pricing mail.Lets try with local SMTP."
|
| - |
|
1458 |
smtpServer = smtplib.SMTP('localhost')
|
| - |
|
1459 |
smtpServer.set_debuglevel(1)
|
| - |
|
1460 |
sender = 'support@shop2020.in'
|
| - |
|
1461 |
try:
|
| - |
|
1462 |
smtpServer.sendmail(sender, recipients, msg.as_string())
|
| - |
|
1463 |
print "Successfully sent email"
|
| - |
|
1464 |
except:
|
| 1433 |
print "Unable to send pricing mail"
|
1465 |
print "Error: unable to send email."
|
| - |
|
1466 |
|
| 1434 |
|
1467 |
|
| 1435 |
def commitPricing(successfulAutoDecrease,successfulAutoIncrease,timestamp):
|
1468 |
def commitPricing(successfulAutoDecrease,successfulAutoIncrease,timestamp):
|
| 1436 |
catalog_client = CatalogClient().get_client()
|
1469 |
catalog_client = CatalogClient().get_client()
|
| 1437 |
inventory_client = InventoryClient().get_client()
|
1470 |
inventory_client = InventoryClient().get_client()
|
| 1438 |
for item in successfulAutoDecrease:
|
1471 |
for item in successfulAutoDecrease:
|
| Line 1579... |
Line 1612... |
| 1579 |
mailServer.login("build@shop2020.in", "cafe@nes")
|
1612 |
mailServer.login("build@shop2020.in", "cafe@nes")
|
| 1580 |
#mailServer.sendmail("cafe@nes", ['kshitij.sood@saholic.com'], msg.as_string())
|
1613 |
#mailServer.sendmail("cafe@nes", ['kshitij.sood@saholic.com'], msg.as_string())
|
| 1581 |
mailServer.sendmail("cafe@nes", recipients, msg.as_string())
|
1614 |
mailServer.sendmail("cafe@nes", recipients, msg.as_string())
|
| 1582 |
except Exception as e:
|
1615 |
except Exception as e:
|
| 1583 |
print e
|
1616 |
print e
|
| 1584 |
print "Unable to send lost buy bix mail"
|
1617 |
print "Unable to send lost buy bix mail.Lets try local SMTP"
|
| - |
|
1618 |
smtpServer = smtplib.SMTP('localhost')
|
| - |
|
1619 |
smtpServer.set_debuglevel(1)
|
| - |
|
1620 |
sender = 'support@shop2020.in'
|
| - |
|
1621 |
try:
|
| - |
|
1622 |
smtpServer.sendmail(sender, recipients, msg.as_string())
|
| - |
|
1623 |
print "Successfully sent email"
|
| - |
|
1624 |
except:
|
| - |
|
1625 |
print "Error: unable to send email."
|
| - |
|
1626 |
|
| 1585 |
|
1627 |
|
| 1586 |
|
1628 |
|
| 1587 |
|
1629 |
|
| 1588 |
def getOtherTp(snapdealDetails,val,spm):
|
1630 |
def getOtherTp(snapdealDetails,val,spm):
|
| 1589 |
if val.parent_category==10011:
|
1631 |
if val.parent_category==10011:
|