Subversion Repositories SmartDukaan

Rev

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

Rev 17036 Rev 17043
Line 23... Line 23...
23
 
23
 
24
mc = MemCache(host_memCache)
24
mc = MemCache(host_memCache)
25
 
25
 
26
 
26
 
27
con  = None
27
con  = None
28
SOURCE_MAP = {'AMAZON':1,'FLIPKART':2,'SNAPDEAL':3,'SAHOLIC':4, 'SHOPCLUES.COM':5,'PAYTM.COM':6}
28
SOURCE_MAP = {'AMAZON':1,'FLIPKART':2,'SNAPDEAL':3,'SAHOLIC':4, 'SHOPCLUES.COM':5,'PAYTM.COM':6,'HOMESHOP18':7}
29
 
29
 
30
headers = { 
30
headers = { 
31
           'User-agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11',
31
           'User-agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11',
32
            'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',      
32
            'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',      
33
            'Accept-Language' : 'en-US,en;q=0.8',                     
33
            'Accept-Language' : 'en-US,en;q=0.8',                     
Line 414... Line 414...
414
                print e
414
                print e
415
            
415
            
416
            response = None
416
            response = None
417
            
417
            
418
            try:
418
            try:
419
                scraper = HomeShop18Scraper(True)
419
                scraper = HomeShop18Scraper.HomeShop18Scraper()
420
                response = scraper.read('http://m.homeshop18.com/product.mobi?productId=%s'%(str(data['identifier'])))
420
                response = scraper.read('http://m.homeshop18.com/product.mobi?productId=%s'%(str(data['identifier'])))
421
            except Exception as e:
421
            except Exception as e:
422
                print e
422
                print e
423
                scraper = HomeShop18Scraper(True)
423
                scraper = HomeShop18Scraper.HomeShop18Scraper()
424
                response = scraper.read('http://m.homeshop18.com/product.mobi?productId=%s'%(str(data['identifier'])))
424
                response = scraper.read('http://m.homeshop18.com/product.mobi?productId=%s'%(str(data['identifier'])))
425
                
425
                
426
            lowestOfferPrice = 0
426
            lowestOfferPrice = 0
427
            inStock = 0
427
            inStock = 0
428
            
428
            
429
            if response is not None:
429
            if response is not None:
430
                lowestOfferPrice = float(response['available_price']+response['shippingCharge'])
430
                lowestOfferPrice = float(response['price']+response['shippingCharge'])
431
                inStock = response['inStock']          
431
                inStock = response['inStock']          
432
                    
432
                    
433
            print lowestOfferPrice
433
            print lowestOfferPrice
434
            print inStock
434
            print inStock
435
            print "*************"
435
            print "*************"
Line 670... Line 670...
670
        info = returnLatestPrice(item, item['source_id'],False)
670
        info = returnLatestPrice(item, item['source_id'],False)
671
        print info
671
        print info
672
 
672
 
673
def main():
673
def main():
674
    print datetime.now()
674
    print datetime.now()
675
    print "retuned %s"%(str(getLatestPrice(1450,1)))
675
    print "retuned %s"%(str(getLatestPrice(1428,7)))
676
    print datetime.now()
676
    print datetime.now()
677
if __name__=='__main__':
677
if __name__=='__main__':
678
    main()
678
    main()
679
    
679