| Line 82... |
Line 82... |
| 82 |
resp['result'] = 'ORDER_NOT_CREATED_KNOWN'
|
82 |
resp['result'] = 'ORDER_NOT_CREATED_KNOWN'
|
| 83 |
else:
|
83 |
else:
|
| 84 |
raise
|
84 |
raise
|
| 85 |
except:
|
85 |
except:
|
| 86 |
try:
|
86 |
try:
|
| 87 |
if soup.h1.text.strip() in ['This is a duplicate order', 'There was a problem with your payment.']:
|
87 |
if soup.h1.text.strip() in ['This is a duplicate order', 'There was a problem with your payment.', 'Your Orders']:
|
| 88 |
resp['result'] = 'ORDER_NOT_CREATED_KNOWN'
|
88 |
resp['result'] = 'ORDER_NOT_CREATED_KNOWN'
|
| 89 |
else:
|
89 |
else:
|
| 90 |
raise
|
90 |
raise
|
| 91 |
except:
|
91 |
except:
|
| 92 |
try:
|
92 |
try:
|
| Line 127... |
Line 127... |
| 127 |
try:
|
127 |
try:
|
| 128 |
self.parseCancelled(merchantOrder, soup)
|
128 |
self.parseCancelled(merchantOrder, soup)
|
| 129 |
resp['result'] = 'ORDER_CANCELLED'
|
129 |
resp['result'] = 'ORDER_CANCELLED'
|
| 130 |
except:
|
130 |
except:
|
| 131 |
try:
|
131 |
try:
|
| 132 |
if soup.h1.span.text=="Account" or soup.h1=="Your Account":
|
132 |
if soup.h1.span.text=="Account" or soup.h1 in ["Your Account"]:
|
| 133 |
resp['result'] = 'DETAIL_NOT_CREATED_KNOWN'
|
133 |
resp['result'] = 'DETAIL_NOT_CREATED_KNOWN'
|
| 134 |
else:
|
134 |
else:
|
| 135 |
raise
|
135 |
raise
|
| 136 |
except:
|
136 |
except:
|
| 137 |
if soup.find(id="ap_signin_pagelet_title").h1.text.strip()=="Sign In":
|
137 |
if soup.find(id="ap_signin_pagelet_title").h1.text.strip()=="Sign In":
|
| Line 246... |
Line 246... |
| 246 |
subOrder.detailedStatus = detailedStatus
|
246 |
subOrder.detailedStatus = detailedStatus
|
| 247 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, unitPrice*quantity)
|
247 |
(cashbackAmount, percentage) = self.getCashbackAmount(subOrder.productCode, unitPrice*quantity)
|
| 248 |
dealRank = getDealRank(subOrder.productCode, self.store_id, merchantOrder.userId)
|
248 |
dealRank = getDealRank(subOrder.productCode, self.store_id, merchantOrder.userId)
|
| 249 |
subOrder.dealRank = dealRank.get('rank')
|
249 |
subOrder.dealRank = dealRank.get('rank')
|
| 250 |
subOrder.rankDesc = dealRank.get('description')
|
250 |
subOrder.rankDesc = dealRank.get('description')
|
| - |
|
251 |
subOrder.maxNlc = dealRank.get('maxNlc')
|
| - |
|
252 |
subOrder.minNlc = dealRank.get('minNlc')
|
| - |
|
253 |
subOrder.db = dealRank.get('dp')
|
| - |
|
254 |
subOrder.itemStatus = dealRank.get('status')
|
| 251 |
cashbackStatus = Store.CB_PENDING
|
255 |
cashbackStatus = Store.CB_PENDING
|
| 252 |
if cashbackAmount <= 0:
|
256 |
if cashbackAmount <= 0:
|
| 253 |
cashbackStatus = Store.CB_NA
|
257 |
cashbackStatus = Store.CB_NA
|
| 254 |
subOrder.cashBackStatus = cashbackStatus
|
258 |
subOrder.cashBackStatus = cashbackStatus
|
| 255 |
subOrder.cashBackAmount = cashbackAmount
|
259 |
subOrder.cashBackAmount = cashbackAmount
|
| Line 605... |
Line 609... |
| 605 |
|
609 |
|
| 606 |
|
610 |
|
| 607 |
|
611 |
|
| 608 |
|
612 |
|
| 609 |
def main():
|
613 |
def main():
|
| 610 |
#str1 = readSSh("/AmazonTrack/User533/403-3748792-1516356")
|
614 |
#str1 = readSSh("/AmazonTrack/User2466/orderSummary28-06:13:25:08")
|
| - |
|
615 |
str1 = readSSh("/AmazonTrack/User2466/orderSummary24-06:17:38:04")
|
| - |
|
616 |
str1 = readSSh("/AmazonTrack/User2466/orderSummary24-06:17:38:01")
|
| - |
|
617 |
str1 = readSSh("/AmazonTrack/User2466/orderSummary24-06:17:31:53")
|
| - |
|
618 |
#str1 = readSSh("/AmazonTrack/User2466/orderSummary28-06:13:25:08")
|
| - |
|
619 |
#str1 = readSSh("/AmazonTrack/User2466/orderSummary28-06:13:25:08")
|
| 611 |
#readSSh("/tmp/User2/404-2225153-7073122")
|
620 |
#readSSh("/tmp/User2/404-2225153-7073122")
|
| 612 |
|
621 |
|
| 613 |
store = getStore(1)
|
622 |
#store = getStore(1)
|
| 614 |
#store.scrapeStoreOrders()
|
623 |
#store.scrapeStoreOrders()
|
| 615 |
# br = mechanize.Browser()
|
624 |
# br = mechanize.Browser()
|
| 616 |
# 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'),
|
625 |
# 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'),
|
| 617 |
# ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
|
626 |
# ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
|
| 618 |
# ('Accept-Encoding', 'gzip,deflate,sdch'),
|
627 |
# ('Accept-Encoding', 'gzip,deflate,sdch'),
|
| 619 |
# ('Accept-Language', 'en-US,en;q=0.8'),
|
628 |
# ('Accept-Language', 'en-US,en;q=0.8'),
|
| 620 |
# ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
|
629 |
# ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
|
| 621 |
# store.scrapeStoreOrders()
|
630 |
# store.scrapeStoreOrders()
|
| 622 |
store.parseOrderRawHtml(5322, "13232", 14, readSSh("/home/amit/5322"), "https://www.amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html/ref=ox_spc_place_order?ie=UTF8&fromAnywhere=1&hasWorkingJav")
|
631 |
#store.parseOrderRawHtml(5322, "13232", 14, readSSh("/home/amit/5322"), "https://www.amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html/ref=ox_spc_place_order?ie=UTF8&fromAnywhere=1&hasWorkingJav")
|
| 623 |
#store.trackOrdersForUser(4355, "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-4824011-7090713", readSSh("~/4355"))
|
632 |
#store.trackOrdersForUser(4355, "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-4824011-7090713", readSSh("~/4355"))
|
| 624 |
#readSSh("/tmp/User211/2015-04-12 10:32:41.905765")
|
633 |
#readSSh("/tmp/User211/2015-04-12 10:32:41.905765")
|
| 625 |
#store.scrapeAffiliate()
|
634 |
#store.scrapeAffiliate()
|
| 626 |
#parseDetailNotCreated()
|
635 |
#parseDetailNotCreated()
|
| 627 |
parseOrderNotCreated()
|
636 |
#parseOrderNotCreated()
|
| 628 |
|
637 |
|
| 629 |
def parseDetailNotCreated():
|
638 |
def parseDetailNotCreated():
|
| 630 |
try:
|
639 |
try:
|
| 631 |
store=getStore(1)
|
640 |
store=getStore(1)
|
| 632 |
orders = session.query(OrdersRaw).filter_by(status='DETAIL_NOT_CREATED_UNKNOWN').all()
|
641 |
orders = session.query(OrdersRaw).filter_by(status='DETAIL_NOT_CREATED_UNKNOWN').all()
|