| Line 26... |
Line 26... |
| 26 |
self.livePricing = livePricing
|
26 |
self.livePricing = livePricing
|
| 27 |
|
27 |
|
| 28 |
def read(self, url):
|
28 |
def read(self, url):
|
| 29 |
response_data = ""
|
29 |
response_data = ""
|
| 30 |
try:
|
30 |
try:
|
| 31 |
response_data = fetchResponseUsingProxy(url,headers=headers,livePricing=self.livePricing,proxy=False)
|
31 |
response_data = fetchResponseUsingProxy(url,headers=headers,livePricing=self.livePricing,proxy=True)
|
| 32 |
except Exception as e:
|
32 |
except Exception as e:
|
| 33 |
print 'ERROR: ', e
|
33 |
print 'ERROR: ', e
|
| 34 |
print 'Retrying'
|
34 |
print 'Retrying'
|
| 35 |
self.count_trials += 1
|
35 |
self.count_trials += 1
|
| 36 |
|
36 |
|
| Line 72... |
Line 72... |
| 72 |
print inStock, sellingPrice, shippingCharge, thumbnail
|
72 |
print inStock, sellingPrice, shippingCharge, thumbnail
|
| 73 |
return {'productId':str(requiredJson['productId']),'price':sellingPrice,'inStock':inStock,'shippingCharge':shippingCharge,'thumbnail':thumbnail}
|
73 |
return {'productId':str(requiredJson['productId']),'price':sellingPrice,'inStock':inStock,'shippingCharge':shippingCharge,'thumbnail':thumbnail}
|
| 74 |
|
74 |
|
| 75 |
if __name__ == '__main__':
|
75 |
if __name__ == '__main__':
|
| 76 |
print datetime.datetime.now()
|
76 |
print datetime.datetime.now()
|
| 77 |
scraper = HomeShop18Scraper(True)
|
77 |
scraper = HomeShop18Scraper()
|
| 78 |
print scraper.read('http://m.homeshop18.com/product.mobi?productId=32866119')
|
78 |
print scraper.read('http://m.homeshop18.com/product.mobi?productId=32998885')
|
| 79 |
print scraper.read('http://www.homeshop18.com/spice-full-touch-dual-sim-phone-m6112/mobiles/mobile-phones/product:32866119/cid:3027/')
|
79 |
#print scraper.read('http://www.homeshop18.com/spice-full-touch-dual-sim-phone-m6112/mobiles/mobile-phones/product:32866119/cid:3027/')
|
| 80 |
#print scraper.read('http://m.homeshop18.com/product/stock.mobi?zipCode=110001&productId=32866119')
|
80 |
#print scraper.read('http://m.homeshop18.com/product/stock.mobi?zipCode=110001&productId=32866119')
|
| 81 |
print datetime.datetime.now()
|
81 |
print datetime.datetime.now()
|