| Line 333... |
Line 333... |
| 333 |
merchantOrder.placedOn
|
333 |
merchantOrder.placedOn
|
| 334 |
merchantOrder.merchantOrderId
|
334 |
merchantOrder.merchantOrderId
|
| 335 |
merchantOrder.paidAmount
|
335 |
merchantOrder.paidAmount
|
| 336 |
|
336 |
|
| 337 |
def parseNewStlye(self, merchantOrder, soup):
|
337 |
def parseNewStlye(self, merchantOrder, soup):
|
| - |
|
338 |
isPrime = False
|
| 338 |
merchantOrder.orderTrackingUrl = merchantOrder.orderSuccessUrl
|
339 |
merchantOrder.orderTrackingUrl = merchantOrder.orderSuccessUrl
|
| - |
|
340 |
for script in soup.findAll("script"):
|
| - |
|
341 |
if script.text:
|
| - |
|
342 |
print script.text
|
| - |
|
343 |
if "\"isPrime\":" in script.text:
|
| - |
|
344 |
isPrime = "\"isPrime\":1" in script.text
|
| - |
|
345 |
break
|
| 339 |
orderDetailsContainer = soup.body.find(id="orderDetails")
|
346 |
orderDetailsContainer = soup.body.find(id="orderDetails")
|
| 340 |
divAfterH1 = orderDetailsContainer.h1.next_sibling.next_sibling
|
347 |
divAfterH1 = orderDetailsContainer.h1.next_sibling.next_sibling
|
| 341 |
orderLeftDiv = divAfterH1.div
|
348 |
orderLeftDiv = divAfterH1.div
|
| 342 |
placedOnSpan = orderLeftDiv.find("span", {'class':'order-date-invoice-item'})
|
349 |
placedOnSpan = orderLeftDiv.find("span", {'class':'order-date-invoice-item'})
|
| 343 |
merchantOrder.placedOn =placedOnSpan.text.split('Ordered on')[1].strip()
|
350 |
merchantOrder.placedOn =placedOnSpan.text.split('Ordered on')[1].strip()
|
| Line 459... |
Line 466... |
| 459 |
|
466 |
|
| 460 |
subOrder.deliveryCharges = shippingPrice
|
467 |
subOrder.deliveryCharges = shippingPrice
|
| 461 |
if trackingUrl:
|
468 |
if trackingUrl:
|
| 462 |
subOrder.trackingUrl = trackingUrl
|
469 |
subOrder.trackingUrl = trackingUrl
|
| 463 |
subOrder.imgUrl = imgDiv.img["src"]
|
470 |
subOrder.imgUrl = imgDiv.img["src"]
|
| - |
|
471 |
if isPrime:
|
| - |
|
472 |
(cashbackAmount, percentage) = (0,0)
|
| - |
|
473 |
else:
|
| 464 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amountPaid/quantity)
|
474 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amountPaid/quantity)
|
| 465 |
dealRank = getDealRank(subOrder.productCode, self.store_id, merchantOrder.userId)
|
475 |
dealRank = getDealRank(subOrder.productCode, self.store_id, merchantOrder.userId)
|
| 466 |
subOrder.dealRank = dealRank.get('rank')
|
476 |
subOrder.dealRank = dealRank.get('rank')
|
| 467 |
subOrder.rankDesc = dealRank.get('description')
|
477 |
subOrder.rankDesc = dealRank.get('description')
|
| 468 |
subOrder.maxNlc = dealRank.get('maxNlc')
|
478 |
subOrder.maxNlc = dealRank.get('maxNlc')
|
| 469 |
subOrder.minNlc = dealRank.get('minNlc')
|
479 |
subOrder.minNlc = dealRank.get('minNlc')
|
| Line 826... |
Line 836... |
| 826 |
|
836 |
|
| 827 |
|
837 |
|
| 828 |
|
838 |
|
| 829 |
def main():
|
839 |
def main():
|
| 830 |
store = getStore(1)
|
840 |
store = getStore(1)
|
| 831 |
#store.parseOrderRawHtml("444444", '123', 14, readSSh('/home/amit/80444.html'), 'https://www.amazon.in/gp/css/summary/edit.html?orderID=402-1449548-9569169')
|
841 |
store.parseOrderRawHtml("444444", '123', 14, readSSh('/home/amit/amit.txt'), 'https://www.amazon.in/gp/css/summary/edit.html?orderID=402-0540293-4683515')
|
| 832 |
orders = list(session.query(OrdersRaw).filter_by(status = 'DETAIL_NOT_CREATED_UNKNOWN').filter(OrdersRaw.id > 61071).all())
|
842 |
# orders = list(session.query(OrdersRaw).filter_by(status = 'DETAIL_NOT_CREATED_UNKNOWN').filter(OrdersRaw.id > 61071).all())
|
| 833 |
session.close()
|
843 |
# session.close()
|
| 834 |
for o in orders:
|
844 |
# for o in orders:
|
| 835 |
try:
|
845 |
# try:
|
| 836 |
store.trackOrdersForUser(o.id, o.order_url, o.rawhtml)
|
846 |
# store.trackOrdersForUser(o.id, o.order_url, o.rawhtml)
|
| 837 |
finally:
|
847 |
# finally:
|
| 838 |
session.close()
|
848 |
# session.close()
|
| 839 |
#store.trackOrdersForUser(10466, 'https://www.amazon.in/gp/css/summary/edit.html?orderID=403-7498756-0837158', readSSh('/AmazonTrack/User10466/403-7498756-0837158'))
|
849 |
#store.trackOrdersForUser(10466, 'https://www.amazon.in/gp/css/summary/edit.html?orderID=403-7498756-0837158', readSSh('/AmazonTrack/User10466/403-7498756-0837158'))
|
| 840 |
#store.trackOrdersForUser(46195, 'https://www.amazon.in/gp/css/summary/edit.html?orderID=404-4294022-1187515', readSSh('/home/amit/amazon.html'))
|
850 |
#store.trackOrdersForUser(46195, 'https://www.amazon.in/gp/css/summary/edit.html?orderID=404-4294022-1187515', readSSh('/home/amit/amazon.html'))
|
| 841 |
|
851 |
|
| 842 |
def getSummaryFile(directory):
|
852 |
def getSummaryFile(directory):
|
| 843 |
date1 = datetime(2015,1,1)
|
853 |
date1 = datetime(2015,1,1)
|