Subversion Repositories SmartDukaan

Rev

Rev 14692 | Rev 14758 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14692 Rev 14696
Line 239... Line 239...
239
    def scrapeStoreOrders(self,):
239
    def scrapeStoreOrders(self,):
240
        #collectionMap = {'palcedOn':1}
240
        #collectionMap = {'palcedOn':1}
241
        orders = self._getActiveOrders()
241
        orders = self._getActiveOrders()
242
        br = getBrowserObject()
242
        br = getBrowserObject()
243
        for order in orders:
243
        for order in orders:
244
            print "Found order ", order
244
            print "Order", self.store_name, order['orderId']
245
            try:
245
            try:
246
                url = ORDER_TRACK_URL + re.findall('.*(\?.*?)$', order['orderSuccessUrl'],re.IGNORECASE)[0]
246
                url = ORDER_TRACK_URL + re.findall('.*(\?.*?)$', order['orderSuccessUrl'],re.IGNORECASE)[0]
247
                response = br.open(url)
247
                response = br.open(url)
248
                page = ungzipResponse(response)
248
                page = ungzipResponse(response)
249
                #page=page.decode("utf-8")
249
                #page=page.decode("utf-8")
Line 332... Line 332...
332
    
332
    
333
                        if breakFlag:
333
                        if breakFlag:
334
                            continue
334
                            continue
335
                                
335
                                
336
                        bulk.find(findMap).update({'$set' : updateMap})
336
                        bulk.find(findMap).update({'$set' : updateMap})
337
                    bulk.find({'orderId': order['orderId']}).update({'$set':{'closed': closed,"parseError":True}})
337
                    bulk.find({'orderId': order['orderId']}).update({'$set':{'closed': closed,"parseError":False}})
338
                result = bulk.execute()
338
                result = bulk.execute()
339
                tprint(result)
339
                tprint(result)
340
            except:
340
            except:
341
                tprint("Could not update " + str(order['orderId']))
341
                tprint("Could not update " + str(order['orderId']))
342
                self.db.merchantOrder.update({"orderId":order['orderId']}, {"$set":{"parseError":True}})
342
                self.db.merchantOrder.update({"orderId":order['orderId']}, {"$set":{"parseError":True}})