| Line 78... |
Line 78... |
| 78 |
else:
|
78 |
else:
|
| 79 |
resp['result'] = 'ORDER_ALREADY_CREATED_IGNORED'
|
79 |
resp['result'] = 'ORDER_ALREADY_CREATED_IGNORED'
|
| 80 |
|
80 |
|
| 81 |
except:
|
81 |
except:
|
| 82 |
#Write all cases here for Order Not created Known
|
82 |
#Write all cases here for Order Not created Known
|
| 83 |
soup = BeautifulSoup(rawHtml)
|
83 |
soup = BeautifulSoup(rawHtml, "html5lib")
|
| 84 |
try:
|
84 |
try:
|
| 85 |
if not soup.body:
|
85 |
if not soup.body:
|
| 86 |
resp['result'] = 'ORDER_NOT_CREATED_KNOWN'
|
86 |
resp['result'] = 'ORDER_NOT_CREATED_KNOWN'
|
| 87 |
elif 'Securely redirecting you' in soup.find("h3").text.strip() or soup.find("h3").text.strip()=="Orders":
|
87 |
elif 'Securely redirecting you' in soup.find("h3").text.strip() or soup.find("h3").text.strip()=="Orders":
|
| 88 |
resp['result'] = 'ORDER_NOT_CREATED_KNOWN'
|
88 |
resp['result'] = 'ORDER_NOT_CREATED_KNOWN'
|
| Line 119... |
Line 119... |
| 119 |
merchantOrder.createdOn = mo.get("createdOn")
|
119 |
merchantOrder.createdOn = mo.get("createdOn")
|
| 120 |
merchantOrder.createdOnInt = mo.get("createdOnInt")
|
120 |
merchantOrder.createdOnInt = mo.get("createdOnInt")
|
| 121 |
else:
|
121 |
else:
|
| 122 |
print "Could not find amazon order with order Id", orderId
|
122 |
print "Could not find amazon order with order Id", orderId
|
| 123 |
merchantOrder = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl)
|
123 |
merchantOrder = Order(orderId, userId, subTagId, self.store_id, orderSuccessUrl)
|
| 124 |
soup = BeautifulSoup(rawHtml)
|
124 |
soup = BeautifulSoup(rawHtml, "html5lib")
|
| 125 |
if not soup.body:
|
125 |
if not soup.body:
|
| 126 |
resp['result'] = 'DETAIL_NOT_CREATED_KNOWN'
|
126 |
resp['result'] = 'DETAIL_NOT_CREATED_KNOWN'
|
| 127 |
else:
|
127 |
else:
|
| 128 |
try:
|
128 |
try:
|
| 129 |
self.parseNewStlye(merchantOrder, soup)
|
129 |
self.parseNewStlye(merchantOrder, soup)
|
| Line 500... |
Line 500... |
| 500 |
filename = directory + "/cancelledSummary" + datetime.strftime(datetime.now(), '%d-%m:%H:%M:%S')
|
500 |
filename = directory + "/cancelledSummary" + datetime.strftime(datetime.now(), '%d-%m:%H:%M:%S')
|
| 501 |
cancelledSummary = True
|
501 |
cancelledSummary = True
|
| 502 |
f = open(filename,'w')
|
502 |
f = open(filename,'w')
|
| 503 |
f.write(rawHtml) # python will convert \n to os.linesep
|
503 |
f.write(rawHtml) # python will convert \n to os.linesep
|
| 504 |
f.close() # you can omit in most cases as the destructor will call if
|
504 |
f.close() # you can omit in most cases as the destructor will call if
|
| 505 |
soup = BeautifulSoup(rawHtml)
|
505 |
soup = BeautifulSoup(rawHtml,'html5lib')
|
| 506 |
allOrders = soup.find(id="ordersContainer").findAll('div', {'class':'a-box-group a-spacing-base order'})
|
506 |
allOrders = soup.find(id="ordersContainer").findAll('div', {'class':'a-box-group a-spacing-base order'})
|
| 507 |
bulk = self.db.merchantOrder.initialize_ordered_bulk_op()
|
507 |
bulk = self.db.merchantOrder.initialize_ordered_bulk_op()
|
| 508 |
for activeOrder in activeOrders:
|
508 |
for activeOrder in activeOrders:
|
| 509 |
matched=False
|
509 |
matched=False
|
| 510 |
for orderEle in allOrders:
|
510 |
for orderEle in allOrders:
|
| Line 909... |
Line 909... |
| 909 |
|
909 |
|
| 910 |
if __name__ == '__main__':
|
910 |
if __name__ == '__main__':
|
| 911 |
# readSSh("/AmazonTrack/User2942/402-2467356-7564367")
|
911 |
# readSSh("/AmazonTrack/User2942/402-2467356-7564367")
|
| 912 |
# readSSh("/AmazonTrack/User10466/orderSummary18-11:21:32:36")
|
912 |
# readSSh("/AmazonTrack/User10466/orderSummary18-11:21:32:36")
|
| 913 |
# readSSh("/AmazonTrack/User5525/171-0333104-6169933")
|
913 |
# readSSh("/AmazonTrack/User5525/171-0333104-6169933")
|
| 914 |
main()
|
914 |
#main()
|
| 915 |
#store=getStore(1)
|
915 |
store=getStore(1)
|
| 916 |
#store.trackOrdersForUser(5525, "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-0333104-6169933", readSSh("/AmazonTrack/User5525/171-0333104-6169933"))
|
916 |
store.trackOrdersForUser(5525, "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-0333104-6169933", readSSh("/AmazonTrack/User5525/171-0333104-6169933"))
|