| Line 97... |
Line 97... |
| 97 |
result = paytmScraper.read(url)
|
97 |
result = paytmScraper.read(url)
|
| 98 |
print result
|
98 |
print result
|
| 99 |
effective_price = result.get('offerPrice')
|
99 |
effective_price = result.get('offerPrice')
|
| 100 |
gross_price = effective_price
|
100 |
gross_price = effective_price
|
| 101 |
coupon = ""
|
101 |
coupon = ""
|
| - |
|
102 |
shareUrl = result.get('shareUrl')
|
| - |
|
103 |
if shareUrl is None:
|
| - |
|
104 |
shareUrl = data['marketPlaceUrl']
|
| 102 |
print result['offerUrl']
|
105 |
print result['offerUrl']
|
| 103 |
try:
|
106 |
try:
|
| 104 |
offers = PaytmOfferScraper.fetchOffers(result['offerUrl'])
|
107 |
offers = PaytmOfferScraper.fetchOffers(result['offerUrl'])
|
| 105 |
try:
|
108 |
try:
|
| 106 |
addToPaytmMaster(offers.get('codes'))
|
109 |
addToPaytmMaster(offers.get('codes'))
|
| Line 118... |
Line 121... |
| 118 |
print "coupon code",coupon
|
121 |
print "coupon code",coupon
|
| 119 |
if len(coupon) > 0:
|
122 |
if len(coupon) > 0:
|
| 120 |
result['codAvailable'] = 0
|
123 |
result['codAvailable'] = 0
|
| 121 |
available_price = effective_price
|
124 |
available_price = effective_price
|
| 122 |
if result['inStock']:
|
125 |
if result['inStock']:
|
| 123 |
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}})
|
126 |
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,'marketPlaceUrl':shareUrl}})
|
| 124 |
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}})
|
127 |
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}})
|
| 125 |
else:
|
128 |
else:
|
| 126 |
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}})
|
129 |
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,'marketPlaceUrl':shareUrl}})
|
| 127 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':0,'codAvailable':result.get('codAvailable')}})
|
130 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':0,'codAvailable':result.get('codAvailable')}})
|
| 128 |
|
131 |
|
| 129 |
except:
|
132 |
except:
|
| 130 |
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}})
|
133 |
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}})
|
| 131 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':0}})
|
134 |
get_mongo_connection().Catalog.Deals.update({'_id':data['_id']}, {'$set' : {'in_stock':0}})
|