| Line 112... |
Line 112... |
| 112 |
traceback.print_exc()
|
112 |
traceback.print_exc()
|
| 113 |
self.parseOldStlye(merchantOrder, soup)
|
113 |
self.parseOldStlye(merchantOrder, soup)
|
| 114 |
resp['result'] = 'DETAIL_CREATED'
|
114 |
resp['result'] = 'DETAIL_CREATED'
|
| 115 |
except:
|
115 |
except:
|
| 116 |
traceback.print_exc()
|
116 |
traceback.print_exc()
|
| - |
|
117 |
try:
|
| 117 |
self.parseCancelled(merchantOrder, soup)
|
118 |
self.parseCancelled(merchantOrder, soup)
|
| 118 |
resp['result'] = 'ORDER_CANCELLED'
|
119 |
resp['result'] = 'ORDER_CANCELLED'
|
| - |
|
120 |
except:
|
| - |
|
121 |
if soup.h1.span.text=="Account":
|
| - |
|
122 |
resp['result'] = 'DETAIL_NOT_CREATED_KNOWN'
|
| - |
|
123 |
|
| 119 |
except:
|
124 |
except:
|
| 120 |
order = self.db.merchantOrder.find_one({"orderId":orderId})
|
125 |
order = self.db.merchantOrder.find_one({"orderId":orderId})
|
| 121 |
if order is not None:
|
126 |
if order is not None:
|
| 122 |
self.db.merchantOrder.update({"orderId":orderId}, {"$set":{"status":"parse_failed"}})
|
127 |
self.db.merchantOrder.update({"orderId":orderId}, {"$set":{"status":"parse_failed"}})
|
| 123 |
print "Error occurred"
|
128 |
print "Error occurred"
|
| Line 551... |
Line 556... |
| 551 |
|
556 |
|
| 552 |
|
557 |
|
| 553 |
|
558 |
|
| 554 |
|
559 |
|
| 555 |
def main():
|
560 |
def main():
|
| 556 |
readSSh("/jd/Kolkata/1")
|
561 |
str1 = readSSh("/AmazonTrack/User779/404-5725877-2507524")
|
| 557 |
#readSSh("/tmp/User2/404-2225153-7073122")
|
562 |
#readSSh("/tmp/User2/404-2225153-7073122")
|
| 558 |
|
563 |
|
| 559 |
#store = getStore(1)
|
564 |
store = getStore(1)
|
| 560 |
#store.scrapeStoreOrders()
|
565 |
#store.scrapeStoreOrders()
|
| 561 |
# br = mechanize.Browser()
|
566 |
# br = mechanize.Browser()
|
| 562 |
# 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'),
|
567 |
# 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'),
|
| 563 |
# ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
|
568 |
# ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
|
| 564 |
# ('Accept-Encoding', 'gzip,deflate,sdch'),
|
569 |
# ('Accept-Encoding', 'gzip,deflate,sdch'),
|
| 565 |
# ('Accept-Language', 'en-US,en;q=0.8'),
|
570 |
# ('Accept-Language', 'en-US,en;q=0.8'),
|
| 566 |
# ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
|
571 |
# ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
|
| 567 |
# store.scrapeStoreOrders()
|
572 |
# store.scrapeStoreOrders()
|
| 568 |
#store.parseOrderRawHtml(1306, "13232", 14, readSSh("/home/amit/2158.html"), "https://www.amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html/ref=ox_spc_place_order?ie=UTF8&fromAnywhere=1&hasWorkingJav")
|
573 |
#store.parseOrderRawHtml(1306, "13232", 14, readSSh("/home/amit/2158.html"), "https://www.amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html/ref=ox_spc_place_order?ie=UTF8&fromAnywhere=1&hasWorkingJav")
|
| 569 |
#store.trackOrdersForUser(94, "https://www.amazon.in/gp/css/order-history", readSSh("/tmp/User94/orderSummary24-04:08:07:34"))
|
574 |
store.trackOrdersForUser(94, "https://www.amazon.in/gp/css/summary/edit.html?orderID=404-5725877-2507524", str1)
|
| 570 |
#readSSh("/tmp/User211/2015-04-12 10:32:41.905765")
|
575 |
#readSSh("/tmp/User211/2015-04-12 10:32:41.905765")
|
| 571 |
#store.scrapeAffiliate()
|
576 |
#store.scrapeAffiliate()
|
| 572 |
def readSSh(fileName):
|
577 |
def readSSh(fileName):
|
| 573 |
try:
|
578 |
try:
|
| 574 |
str1 = open(fileName).read()
|
579 |
str1 = open(fileName).read()
|
| 575 |
return str1
|
580 |
return str1
|
| 576 |
except:
|
581 |
except:
|
| 577 |
ssh_client = SSHClient()
|
582 |
ssh_client = SSHClient()
|
| 578 |
str1 = ""
|
583 |
str1 = ""
|
| 579 |
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
584 |
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
| 580 |
ssh_client.connect('45.33.50.227', 22, 'root', 'ecip$db1May2014')
|
585 |
ssh_client.connect('dtr', 22, 'root', 'ecip$dtrMay2014')
|
| 581 |
sftp_client = ssh_client.open_sftp()
|
586 |
sftp_client = ssh_client.open_sftp()
|
| 582 |
try:
|
587 |
try:
|
| 583 |
if not os.path.exists(os.path.dirname(fileName)):
|
588 |
if not os.path.exists(os.path.dirname(fileName)):
|
| 584 |
os.makedirs(os.path.dirname(fileName))
|
589 |
os.makedirs(os.path.dirname(fileName))
|
| 585 |
sftp_client.get(fileName, fileName)
|
590 |
sftp_client.get(fileName, fileName)
|