| Line 276... |
Line 276... |
| 276 |
subOrder.productCode = productUrl.split('/')[5]
|
276 |
subOrder.productCode = productUrl.split('/')[5]
|
| 277 |
subOrder.unitPrice = unitPrice
|
277 |
subOrder.unitPrice = unitPrice
|
| 278 |
subOrder.merchantSubOrderId = str(i) + " of " + merchantOrder.merchantOrderId
|
278 |
subOrder.merchantSubOrderId = str(i) + " of " + merchantOrder.merchantOrderId
|
| 279 |
estDlvyTime = datetime.now()
|
279 |
estDlvyTime = datetime.now()
|
| 280 |
if deliverySpan is not None:
|
280 |
if deliverySpan is not None:
|
| - |
|
281 |
try:
|
| 281 |
subOrder.estimatedDeliveryDate = deliverySpan.span.text.strip()
|
282 |
subOrder.estimatedDeliveryDate = deliverySpan.span.text.strip()
|
| 282 |
estDate = subOrder.estimatedDeliveryDate.split("-")[0].strip()
|
283 |
estDate = subOrder.estimatedDeliveryDate.split("-")[0].strip()
|
| 283 |
subOrder.estimatedDeliveryInt = int(time.mktime((datetime.strptime(estDate, "%A %d %B %Y")).timetuple()))
|
284 |
subOrder.estimatedDeliveryInt = int(time.mktime((datetime.strptime(estDate, "%A %d %B %Y")).timetuple()))
|
| 284 |
estDlvyTime = datetime.strptime(estDate, "%A %d %B %Y")
|
285 |
estDlvyTime = datetime.strptime(estDate, "%A %d %B %Y")
|
| 285 |
|
286 |
except:
|
| - |
|
287 |
subOrder.estimatedDeliveryDate = "Not available"
|
| 286 |
createdOn = datetime.fromtimestamp(merchantOrder.createdOnInt)
|
288 |
createdOn = datetime.fromtimestamp(merchantOrder.createdOnInt)
|
| 287 |
subOrder.trackAfter = int(time.mktime(max(estDlvyTime-timedelta(days=4),createdOn + timedelta(days=3)).timetuple()))/1000
|
289 |
subOrder.trackAfter = int(time.mktime(max(estDlvyTime-timedelta(days=4),createdOn + timedelta(days=3)).timetuple()))
|
| 288 |
subOrder.detailedStatus = subOrderStatus
|
290 |
subOrder.detailedStatus = subOrderStatus
|
| 289 |
subOrder.deliveryCharges = shippingPrice
|
291 |
subOrder.deliveryCharges = shippingPrice
|
| 290 |
subOrder.imgUrl = imgDiv.img["src"]
|
292 |
subOrder.imgUrl = imgDiv.img["src"]
|
| 291 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amountPaid)
|
293 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, amountPaid)
|
| 292 |
cashbackStatus = Store.CB_PENDING
|
294 |
cashbackStatus = Store.CB_PENDING
|
| Line 505... |
Line 507... |
| 505 |
|
507 |
|
| 506 |
|
508 |
|
| 507 |
|
509 |
|
| 508 |
def main():
|
510 |
def main():
|
| 509 |
store = getStore(1)
|
511 |
store = getStore(1)
|
| 510 |
store.scrapeStoreOrders()
|
512 |
#store.scrapeStoreOrders()
|
| 511 |
# br = mechanize.Browser()
|
513 |
# br = mechanize.Browser()
|
| 512 |
# br.addheaders = [('User-agent','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11'),
|
514 |
# br.addheaders = [('User-agent','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11'),
|
| 513 |
# ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
|
515 |
# ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
|
| 514 |
# ('Accept-Encoding', 'gzip,deflate,sdch'),
|
516 |
# ('Accept-Encoding', 'gzip,deflate,sdch'),
|
| 515 |
# ('Accept-Language', 'en-US,en;q=0.8'),
|
517 |
# ('Accept-Language', 'en-US,en;q=0.8'),
|
| 516 |
# ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
|
518 |
# ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
|
| 517 |
# store.scrapeStoreOrders()
|
519 |
# store.scrapeStoreOrders()
|
| 518 |
#store.parseOrderRawHtml(2121, "13232", 14, readSSh("/home/amit/1313.html"), "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-5857029-0804336")
|
520 |
store.parseOrderRawHtml(1306, "13232", 14, readSSh("/home/amit/322.html"), "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-5857029-0804336")
|
| 519 |
#store.parseOrderRawHtml(2121, "13232", 14, readSSh("/home/amit/f1.html"), "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-5196461-3230730")
|
521 |
#store.parseOrderRawHtml(2121, "13232", 14, readSSh("/home/amit/f1.html"), "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-5196461-3230730")
|
| 520 |
#readSSh("/tmp/User211/2015-04-01 15:31:42.250309")
|
522 |
#readSSh("/tmp/User211/2015-04-01 15:31:42.250309")
|
| 521 |
#store.scrapeAffiliate()
|
523 |
#store.scrapeAffiliate()
|
| 522 |
def readSSh(fileName):
|
524 |
def readSSh(fileName):
|
| 523 |
try:
|
525 |
try:
|