| Line 97... |
Line 97... |
| 97 |
f = open(filename,'w')
|
97 |
f = open(filename,'w')
|
| 98 |
f.write(rawHtml) # python will convert \n to os.linesep
|
98 |
f.write(rawHtml) # python will convert \n to os.linesep
|
| 99 |
f.close() # you can omit in most cases as the destructor will call if
|
99 |
f.close() # you can omit in most cases as the destructor will call if
|
| 100 |
rawHtml = "".join(["{", find_between(rawHtml,">{", "}</pre>"), "}"])
|
100 |
rawHtml = "".join(["{", find_between(rawHtml,">{", "}</pre>"), "}"])
|
| 101 |
merchantOrder = self.db.merchantOrder.find_one({"merchantOrderId":merchantOrderId})
|
101 |
merchantOrder = self.db.merchantOrder.find_one({"merchantOrderId":merchantOrderId})
|
| - |
|
102 |
print rawHtml
|
| 102 |
if rawHtml == "":
|
103 |
if rawHtml == "":
|
| 103 |
tprint("Could not update " + str(merchantOrder['orderId']) + " For store " + self.getName())
|
104 |
tprint("Could not update " + str(merchantOrder['orderId']) + " For store " + self.getName())
|
| 104 |
self.db.merchantOrder.update({"orderId":merchantOrder['orderId']}, {"$set":{"parseError":True}})
|
105 |
self.db.merchantOrder.update({"orderId":merchantOrder['orderId']}, {"$set":{"parseError":True}})
|
| 105 |
raise
|
106 |
raise
|
| 106 |
ordermap = json.loads(rawHtml).get("order")
|
107 |
ordermap = json.loads(rawHtml).get("order")
|
| Line 109... |
Line 110... |
| 109 |
closed=True
|
110 |
closed=True
|
| 110 |
for item in ordermap.get("items"):
|
111 |
for item in ordermap.get("items"):
|
| 111 |
merchantSubOrderId = str(item.get("id"))
|
112 |
merchantSubOrderId = str(item.get("id"))
|
| 112 |
for subOrder in merchantOrder.get("subOrders"):
|
113 |
for subOrder in merchantOrder.get("subOrders"):
|
| 113 |
if not subOrder.get("closed"):
|
114 |
if not subOrder.get("closed"):
|
| 114 |
if merchantSubOrderId == subOrder.get("merchantSubOrderId") and item.get("status_text") != subOrder.get("detailedStatus"):
|
115 |
if merchantSubOrderId == subOrder.get("merchantSubOrderId"):
|
| 115 |
executeBulk = True
|
116 |
executeBulk = True
|
| 116 |
findMap = {"orderId":merchantOrder.get("orderId"), "subOrders.merchantSubOrderId":subOrder.get("merchantSubOrderId")}
|
117 |
findMap = {"orderId":merchantOrder.get("orderId"), "subOrders.merchantSubOrderId":subOrder.get("merchantSubOrderId")}
|
| 117 |
newSub = {}
|
118 |
newSub = {}
|
| 118 |
detailedStatus = item.get("status_text")
|
119 |
detailedStatus = item.get("status_text")
|
| 119 |
newSub['detailedStatus'] = detailedStatus
|
120 |
newSub['detailedStatus'] = detailedStatus
|
| Line 223... |
Line 224... |
| 223 |
return tzDate
|
224 |
return tzDate
|
| 224 |
|
225 |
|
| 225 |
def main():
|
226 |
def main():
|
| 226 |
store = getStore(6)
|
227 |
store = getStore(6)
|
| 227 |
#store.scrapeStoreOrders()
|
228 |
#store.scrapeStoreOrders()
|
| 228 |
store.parseOrderRawHtml(312119, 'SUB1', 14, readSSh("/home/amit/paytm.json"), "someurl")
|
229 |
store.trackOrdersForUser(2, "https://paytm.com/shop/orderdetail/1168545614?actions=1&channel=web&version=2", readSSh("/PaytmTrack/User2/1168545614-20-08:12:43:21"))
|
| 229 |
#print store.getTrackingUrls(14)
|
230 |
#print store.getTrackingUrls(14)
|
| 230 |
|
231 |
|
| 231 |
if __name__ == '__main__':
|
232 |
if __name__ == '__main__':
|
| 232 |
main()
|
233 |
main()
|
| 233 |
|
234 |
|