| Line 103... |
Line 103... |
| 103 |
url = "https://catalog.paytm.com/v1/mobile/product/%s"%(data['identifier'].strip())
|
103 |
url = "https://catalog.paytm.com/v1/mobile/product/%s"%(data['identifier'].strip())
|
| 104 |
try:
|
104 |
try:
|
| 105 |
result = paytmScraper.read(url)
|
105 |
result = paytmScraper.read(url)
|
| 106 |
print result
|
106 |
print result
|
| 107 |
effective_price = result.get('offerPrice')
|
107 |
effective_price = result.get('offerPrice')
|
| - |
|
108 |
gross_price = effective_price
|
| 108 |
coupon = ""
|
109 |
coupon = ""
|
| 109 |
print result['offerUrl']
|
110 |
print result['offerUrl']
|
| 110 |
try:
|
111 |
try:
|
| 111 |
offers = PaytmOfferScraper.fetchOffers(result['offerUrl'])
|
112 |
offers = PaytmOfferScraper.fetchOffers(result['offerUrl'])
|
| 112 |
try:
|
113 |
try:
|
| Line 123... |
Line 124... |
| 123 |
except:
|
124 |
except:
|
| 124 |
traceback.print_exc()
|
125 |
traceback.print_exc()
|
| 125 |
print "coupon code",coupon
|
126 |
print "coupon code",coupon
|
| 126 |
available_price = effective_price
|
127 |
available_price = effective_price
|
| 127 |
if result['inStock']:
|
128 |
if result['inStock']:
|
| 128 |
get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'available_price':available_price,'updatedOn':to_java_date(datetime.now()),'priceUpdatedOn':to_java_date(datetime.now()),'in_stock':1,'buyBoxFlag':1,'codAvailable':result.get('codAvailable'),'coupon':coupon}})
|
129 |
get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'available_price':available_price,'updatedOn':to_java_date(datetime.now()),'priceUpdatedOn':to_java_date(datetime.now()),'in_stock':1,'buyBoxFlag':1,'codAvailable':result.get('codAvailable'),'coupon':coupon,'gross_price':gross_price}})
|
| 129 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'available_price':available_price , 'in_stock':1,'codAvailable':result.get('codAvailable')}})
|
130 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'available_price':available_price , 'in_stock':1,'codAvailable':result.get('codAvailable'),'gross_price':gross_price}})
|
| 130 |
else:
|
131 |
else:
|
| 131 |
get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'updatedOn':to_java_date(datetime.now()),'in_stock':0,'priceUpdatedOn':to_java_date(datetime.now()),'buyBoxFlag':1,'codAvailable':result.get('codAvailable'),'coupon':coupon}})
|
132 |
get_mongo_connection().Catalog.MasterData.update({'_id':data['_id']}, {'$set' : {'updatedOn':to_java_date(datetime.now()),'in_stock':0,'priceUpdatedOn':to_java_date(datetime.now()),'buyBoxFlag':1,'codAvailable':result.get('codAvailable'),'coupon':coupon}})
|
| 132 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':0,'codAvailable':result.get('codAvailable')}})
|
133 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':0,'codAvailable':result.get('codAvailable')}})
|
| 133 |
|
134 |
|
| 134 |
except:
|
135 |
except:
|