| Line 397... |
Line 397... |
| 397 |
return json.loads(jsonValue)
|
397 |
return json.loads(jsonValue)
|
| 398 |
|
398 |
|
| 399 |
def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
|
399 |
def parseOrderRawHtml(self, orderId, subTagId, userId, rawHtml, orderSuccessUrl):
|
| 400 |
#print merchantOrder
|
400 |
#print merchantOrder
|
| 401 |
resp = {}
|
401 |
resp = {}
|
| 402 |
url = ORDER_TRACK_URL + re.findall('.*(\?.*?)$', orderSuccessUrl,re.IGNORECASE)[0]
|
402 |
orderPart = re.findall('.*(\?.*?)$', orderSuccessUrl,re.IGNORECASE)[0]
|
| - |
|
403 |
url = ORDER_TRACK_URL + orderPart
|
| - |
|
404 |
moId = orderPart.split("order=")[-1].split("&")[0]
|
| - |
|
405 |
if self.db.merchantOrder.find_one({"merchantOrderId":moId}):
|
| - |
|
406 |
resp['result'] = 'ORDER_ALREDY_CREATED_IGNORED'
|
| - |
|
407 |
return resp
|
| 403 |
supcMap = {}
|
408 |
supcMap = {}
|
| 404 |
try:
|
409 |
try:
|
| 405 |
try:
|
410 |
try:
|
| 406 |
orderJSON = self.getOrderJSON(rawHtml, supcMap)
|
411 |
orderJSON = self.getOrderJSON(rawHtml, supcMap)
|
| 407 |
except:
|
412 |
except:
|
| Line 412... |
Line 417... |
| 412 |
except:
|
417 |
except:
|
| 413 |
traceback.print_exc()
|
418 |
traceback.print_exc()
|
| 414 |
orderJSON = None
|
419 |
orderJSON = None
|
| 415 |
if orderJSON is None:
|
420 |
if orderJSON is None:
|
| 416 |
page =fetchResponseUsingProxy(url)
|
421 |
page =fetchResponseUsingProxy(url)
|
| 417 |
page = ungzipResponse(page)
|
- |
|
| 418 |
try:
|
422 |
try:
|
| 419 |
merchantOrder = self._parseB(orderId, subTagId, userId, page, orderSuccessUrl)
|
423 |
merchantOrder = self._parseB(orderId, subTagId, userId, page, orderSuccessUrl)
|
| 420 |
except:
|
424 |
except:
|
| 421 |
traceback.print_exc()
|
425 |
traceback.print_exc()
|
| 422 |
merchantOrder = self._parse(orderId, subTagId, userId, page, orderSuccessUrl)
|
426 |
merchantOrder = self._parse(orderId, subTagId, userId, page, orderSuccessUrl)
|
| Line 907... |
Line 911... |
| 907 |
|
911 |
|
| 908 |
|
912 |
|
| 909 |
def main():
|
913 |
def main():
|
| 910 |
#print todict([1,2,"3"])
|
914 |
#print todict([1,2,"3"])
|
| 911 |
store = getStore(3)
|
915 |
store = getStore(3)
|
| 912 |
#store.parseOrderRawHtml(332221, "3232311", 2, readSSh("/home/amit/snapdeal.html"), "https://m.snapdeal.com/purchaseMobileComplete?code=b92753bd7236bb3efbd6e8a0df46b962&order=9627657388")
|
916 |
store.parseOrderRawHtml(332221, "3232311", 2, readSSh("/home/amit/65185.html"), " https://m.snapdeal.com/purchaseMobileComplete?code=a8b3420d4c5bc248ea887df6c9b3a724&order=10478372453")
|
| 913 |
store.scrapeAffiliate()
|
917 |
#store.scrapeAffiliate()
|
| 914 |
#https://m.snapdeal.com/purchaseMobileComplete?code=3fbc8a02a1c4d3c4e906f46886de0464&order=5808451506
|
918 |
#https://m.snapdeal.com/purchaseMobileComplete?code=3fbc8a02a1c4d3c4e906f46886de0464&order=5808451506
|
| 915 |
#https://m.snapdeal.com/purchaseMobileComplete?code=9f4dfa49ff08a16d04c5e4bf519506fc&order=9611672826
|
919 |
#https://m.snapdeal.com/purchaseMobileComplete?code=9f4dfa49ff08a16d04c5e4bf519506fc&order=9611672826
|
| 916 |
|
920 |
|
| 917 |
# orders = list(session.query(OrdersRaw).filter_by(store_id=3).filter_by(status='ORDER_NOT_CREATED').all())
|
921 |
# orders = list(session.query(OrdersRaw).filter_by(store_id=3).filter_by(status='ORDER_NOT_CREATED').all())
|
| 918 |
# for o in orders:
|
922 |
# for o in orders:
|