| Line 159... |
Line 159... |
| 159 |
missingOrderUrls.append(ORDER_REDIRECT_URL%(missingOrder['merchantOrderId']))
|
159 |
missingOrderUrls.append(ORDER_REDIRECT_URL%(missingOrder['merchantOrderId']))
|
| 160 |
orders = self._getActiveOrders({'userId':userId})
|
160 |
orders = self._getActiveOrders({'userId':userId})
|
| 161 |
count = len(orders)
|
161 |
count = len(orders)
|
| 162 |
print "count", count
|
162 |
print "count", count
|
| 163 |
if count > 0:
|
163 |
if count > 0:
|
| 164 |
return missingOrderUrls + ['https://www.amazon.in/gp/css/order-history', 'https://www.amazon.in/gp/css/order-history/?orderFilter=cancelled']
|
164 |
return missingOrderUrls + ['https://www.amazon.in/gp/css/order-history', 'https://www.amazon.in/gp/css/order-history/?orderFilter=cancelled', 'https://www.amazon.in/gp/css/order-history?orderFilter=cancelled&startIndex=10']
|
| 165 |
else:
|
165 |
else:
|
| 166 |
return missingOrderUrls
|
166 |
return missingOrderUrls
|
| 167 |
|
167 |
|
| 168 |
def trackOrdersForUser(self, userId, url, rawHtml):
|
168 |
def trackOrdersForUser(self, userId, url, rawHtml):
|
| 169 |
directory = "/tmp/User" + str(userId)
|
169 |
directory = "/tmp/User" + str(userId)
|
| Line 181... |
Line 181... |
| 181 |
activeOrders = self._getActiveOrders(searchMap, collectionMap)
|
181 |
activeOrders = self._getActiveOrders(searchMap, collectionMap)
|
| 182 |
datetimeNow = datetime.now()
|
182 |
datetimeNow = datetime.now()
|
| 183 |
timestamp = int(time.mktime(datetimeNow.timetuple()))
|
183 |
timestamp = int(time.mktime(datetimeNow.timetuple()))
|
| 184 |
print "url----------------", url
|
184 |
print "url----------------", url
|
| 185 |
|
185 |
|
| 186 |
if url == 'https://www.amazon.in/gp/css/order-history' or url == 'https://www.amazon.in/gp/css/order-history/?orderFilter=cancelled':
|
186 |
if url == 'https://www.amazon.in/gp/css/order-history' or 'https://www.amazon.in/gp/css/order-history/?orderFilter=cancelled' in url:
|
| 187 |
soup = BeautifulSoup(rawHtml)
|
187 |
soup = BeautifulSoup(rawHtml)
|
| 188 |
allOrders = soup.find(id="ordersContainer").findAll('div', {'class':'a-box-group a-spacing-base order'})
|
188 |
allOrders = soup.find(id="ordersContainer").findAll('div', {'class':'a-box-group a-spacing-base order'})
|
| 189 |
bulk = self.db.merchantOrder.initialize_ordered_bulk_op()
|
189 |
bulk = self.db.merchantOrder.initialize_ordered_bulk_op()
|
| 190 |
for activeOrder in activeOrders:
|
190 |
for activeOrder in activeOrders:
|
| 191 |
for orderEle in allOrders:
|
191 |
for orderEle in allOrders:
|
| Line 279... |
Line 279... |
| 279 |
|
279 |
|
| 280 |
def main():
|
280 |
def main():
|
| 281 |
store = getStore(1)
|
281 |
store = getStore(1)
|
| 282 |
|
282 |
|
| 283 |
#store.parseOrderRawHtml(1, 'saad', '2123221', readSSh('/tmp/User8/2015-03-02 12:51:59.545557'), 'https://www.amazon.in/gp/css/summary/edit.html?orderID=12212')
|
283 |
#store.parseOrderRawHtml(1, 'saad', '2123221', readSSh('/tmp/User8/2015-03-02 12:51:59.545557'), 'https://www.amazon.in/gp/css/summary/edit.html?orderID=12212')
|
| 284 |
store.trackOrdersForUser(8,'https://www.amazon.in/gp/css/order-history', readSSh('/tmp/User8/2015-03-02 12:51:59.545557'))
|
284 |
store.trackOrdersForUser(8,'https://www.amazon.in/gp/css/order-history', readSSh('/tmp/User2/2015-03-02 23:02:16.531611'))
|
| 285 |
|
285 |
|
| 286 |
def readSSh(fileName):
|
286 |
def readSSh(fileName):
|
| 287 |
try:
|
287 |
try:
|
| 288 |
str1 = open(fileName).read()
|
288 |
str1 = open(fileName).read()
|
| 289 |
return str1
|
289 |
return str1
|