Subversion Repositories SmartDukaan

Rev

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

Rev 14961 Rev 14962
Line 405... Line 405...
405
                                sdivs = shipment.div.div.findAll('div', recursive=False)
405
                                sdivs = shipment.div.div.findAll('div', recursive=False)
406
                                orderStatus = sdivs[0].span.text.strip()
406
                                orderStatus = sdivs[0].span.text.strip()
407
                                status = self._getStatusFromDetailedStatus(orderStatus)
407
                                status = self._getStatusFromDetailedStatus(orderStatus)
408
                                if status == MStore.ORDER_DELIVERED:
408
                                if status == MStore.ORDER_DELIVERED:
409
                                    deliveredOn = sdivs[0].findAll('span')[-1].text.strip()
409
                                    deliveredOn = sdivs[0].findAll('span')[-1].text.strip()
-
 
410
                                    try:
410
                                    deliveredOn = deliveredOn.split(":")[1].strip()
411
                                        deliveredOn = deliveredOn.split(":")[1].strip()
-
 
412
                                    except:
-
 
413
                                        deliveredOn = "" 
411
                                deliveryestimatespan = sdivs[0].find('span', {'class':'a-color-success'})
414
                                deliveryestimatespan = sdivs[0].find('span', {'class':'a-color-success'})
412
                                deliveryEstimate = None
415
                                deliveryEstimate = None
413
                                if deliveryestimatespan is not None:
416
                                if deliveryestimatespan is not None:
414
                                    deliveryEstimate = deliveryestimatespan.find('span', {'class':'a-text-bold'}).text.strip()
417
                                    deliveryEstimate = deliveryestimatespan.find('span', {'class':'a-text-bold'}).text.strip()
415
                                productDivs = shipdiv.find('div', {'class':re.compile('.*?a-spacing-top-medium.*?')}).find('div', {'class':'a-row'}).findAll('div', recursive=False)
418
                                productDivs = shipdiv.find('div', {'class':re.compile('.*?a-spacing-top-medium.*?')}).find('div', {'class':'a-row'}).findAll('div', recursive=False)
Line 541... Line 544...
541
        
544
        
542
        
545
        
543
 
546
 
544
 
547
 
545
def main():
548
def main():
546
    readSSh("/tmp/order2015-04-23 12:39:09.743683")
549
    #readSSh("/tmp/User94/orderSummary24-04:08:07:34")
-
 
550
    
547
    #store = getStore(1)
551
    store = getStore(1)
548
    #store.scrapeStoreOrders()
552
    #store.scrapeStoreOrders()
549
#    br = mechanize.Browser()
553
#    br = mechanize.Browser()
550
#    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'),
554
#    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'),
551
#                     ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
555
#                     ('Accept', 'text/html,application/xhtml+xml,application/json,application/xml;q=0.9,*/*;q=0.8'),
552
#                     ('Accept-Encoding', 'gzip,deflate,sdch'),                  
556
#                     ('Accept-Encoding', 'gzip,deflate,sdch'),                  
553
#                     ('Accept-Language', 'en-US,en;q=0.8'),                     
557
#                     ('Accept-Language', 'en-US,en;q=0.8'),                     
554
#                     ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
558
#                     ('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.3')]
555
#    store.scrapeStoreOrders()
559
#    store.scrapeStoreOrders()
556
    #store.parseOrderRawHtml(1306, "13232", 14, readSSh("/home/amit/322.html"), "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-5570474-5548341")
560
    #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")
557
    #store.parseOrderRawHtml(2121, "13232", 14, readSSh("/home/amit/f1.html"), "https://www.amazon.in/gp/css/summary/edit.html?orderID=171-5196461-3230730")
561
    store.trackOrdersForUser(94, "https://www.amazon.in/gp/css/order-history", readSSh("/tmp/User94/orderSummary24-04:08:07:34"))
558
    #readSSh("/tmp/User211/2015-04-12 10:32:41.905765")
562
    #readSSh("/tmp/User211/2015-04-12 10:32:41.905765")
559
    #store.scrapeAffiliate()
563
    #store.scrapeAffiliate()
560
def readSSh(fileName):
564
def readSSh(fileName):
561
    try:
565
    try:
562
            str1 = open(fileName).read()
566
            str1 = open(fileName).read()