| Line 161... |
Line 161... |
| 161 |
traceback.print_exc()
|
161 |
traceback.print_exc()
|
| 162 |
return resp
|
162 |
return resp
|
| 163 |
|
163 |
|
| 164 |
#This should be exposed from api for specific sources
|
164 |
#This should be exposed from api for specific sources
|
| 165 |
def scrapeStoreOrders(self):
|
165 |
def scrapeStoreOrders(self):
|
| 166 |
orders = self.db.merchantOrder.find({"storeId":1, "closed":False, "subOrders.closed":False, "subOrders.trackingUrl":{"$exists":True}})
|
166 |
orders = self.db.merchantOrder.find({"storeId":1, "closed":False, "subOrders.closed":False, "subOrders.trackingUrl":{"$exists":True}, "subOrders.login":{"$exists":False}})
|
| 167 |
for merchantOrder in orders:
|
167 |
for merchantOrder in orders:
|
| 168 |
executeBulk = False
|
168 |
executeBulk = False
|
| 169 |
try:
|
169 |
try:
|
| 170 |
bulk = self.db.merchantOrder.initialize_ordered_bulk_op()
|
170 |
bulk = self.db.merchantOrder.initialize_ordered_bulk_op()
|
| 171 |
closed = True
|
171 |
closed = True
|
| Line 326... |
Line 326... |
| 326 |
for productDetail in productDetails:
|
326 |
for productDetail in productDetails:
|
| 327 |
productDetail = pq(productDetail)
|
327 |
productDetail = pq(productDetail)
|
| 328 |
pImg = productDetail.children('div').eq(0)
|
328 |
pImg = productDetail.children('div').eq(0)
|
| 329 |
pQty = productDetail.children('div').eq(1)
|
329 |
pQty = productDetail.children('div').eq(1)
|
| 330 |
#print pImg('a').attr('href'), pImg('a').attr('title'), pImg('img').attr('src'), pQty('.a-row:nth-child(2)')('span').text().split(':')[1].strip(), pQty('span.currencyINR')
|
330 |
#print pImg('a').attr('href'), pImg('a').attr('title'), pImg('img').attr('src'), pQty('.a-row:nth-child(2)')('span').text().split(':')[1].strip(), pQty('span.currencyINR')
|
| - |
|
331 |
productUrl = pImg('a').attr('href'),
|
| 331 |
print pImg('a').attr('href'), pQty('.a-row:nth-child(2)')('span').text().split(':')[1].strip()
|
332 |
qty = pQty('.a-row:nth-child(2)')('span').text().split(':')[1].strip()
|
| 332 |
print int(float(pQty('nobr').text().replace('Rs.','').replace(',', '')))
|
333 |
price = int(float(pQty('nobr').text().replace('Rs.','').replace(',', '')))
|
| - |
|
334 |
#subOrder = SubOrder(productTitle, productUrl, merchantOrder.placedOn, amountPaid, MStore.ORDER_PLACED, quantity)
|
| 333 |
|
335 |
|
| 334 |
|
336 |
|
| 335 |
raise
|
337 |
raise
|
| 336 |
|
338 |
|
| 337 |
|
339 |
|
| Line 763... |
Line 765... |
| 763 |
header1 = soup.find("h1")
|
765 |
header1 = soup.find("h1")
|
| 764 |
if header1:
|
766 |
if header1:
|
| 765 |
if header1.text=="Sign In":
|
767 |
if header1.text=="Sign In":
|
| 766 |
print "Login page is displayed for order id", orderId
|
768 |
print "Login page is displayed for order id", orderId
|
| 767 |
self.db.merchantOrder.update({"orderId":orderId}, {"$set":{"trackError":True}})
|
769 |
self.db.merchantOrder.update({"orderId":orderId}, {"$set":{"trackError":True}})
|
| - |
|
770 |
subOrder['login'] = True
|
| 768 |
return subOrder
|
771 |
return subOrder
|
| 769 |
try:
|
772 |
try:
|
| 770 |
print "Tracking page is displayed for order id", orderId
|
773 |
print "Tracking page is displayed for order id", orderId
|
| 771 |
detailedStatus = soup.find("div", {"class":"top"}).span.text.strip()
|
774 |
detailedStatus = soup.find("div", {"class":"top"}).span.text.strip()
|
| 772 |
try:
|
775 |
try:
|