| Line 8... |
Line 8... |
| 8 |
to_t_source_item_pricing, to_t_product_notification_request, \
|
8 |
to_t_source_item_pricing, to_t_product_notification_request, \
|
| 9 |
to_t_banner, to_t_banner_map, to_t_product_notification_request_count, \
|
9 |
to_t_banner, to_t_banner_map, to_t_product_notification_request_count, \
|
| 10 |
to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
|
10 |
to_t_voucher_item_mapping, to_t_insurer, to_t_Amazonlisted, to_t_ebay_item, \
|
| 11 |
to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item, \
|
11 |
to_t_uri_mapping, to_t_banner_list, to_t_campaign,to_t_snapdeal_item, \
|
| 12 |
to_t_snapdeal_item_details, to_t_product_feed_submit, to_t_marketplace_items, to_t_marketplace_itemprice,\
|
12 |
to_t_snapdeal_item_details, to_t_product_feed_submit, to_t_marketplace_items, to_t_marketplace_itemprice,\
|
| 13 |
to_t_marketplacepercentage, to_t_flipkart_item
|
13 |
to_t_marketplacepercentage, to_t_flipkart_item, to_t_flipkart_item_details
|
| 14 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
14 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
| 15 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
15 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
| 16 |
update_item, start_item_on, close_session, retire_item_on, \
|
16 |
update_item, start_item_on, close_session, retire_item_on, \
|
| 17 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
17 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
| 18 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
18 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
| Line 55... |
Line 55... |
| 55 |
get_active_banners_for_mobile_site, get_preffered_insurer_for_item, get_snapdealitem_by_skuatsnapdeal, \
|
55 |
get_active_banners_for_mobile_site, get_preffered_insurer_for_item, get_snapdealitem_by_skuatsnapdeal, \
|
| 56 |
get_product_feed_submit, add_product_feed_submit, update_product_feed_submit, \
|
56 |
get_product_feed_submit, add_product_feed_submit, update_product_feed_submit, \
|
| 57 |
delete_product_feed_submit, get_all_product_feed_submit, get_snapdeal_item_detail,\
|
57 |
delete_product_feed_submit, get_all_product_feed_submit, get_snapdeal_item_detail,\
|
| 58 |
get_marketplace_details_for_item, update_marketplace_attributes_for_item,\
|
58 |
get_marketplace_details_for_item, update_marketplace_attributes_for_item,\
|
| 59 |
get_costing_for_marketplace, get_all_marketplace_items_for_priceupdate, update_marketplace_priceupdate_status, \
|
59 |
get_costing_for_marketplace, get_all_marketplace_items_for_priceupdate, update_marketplace_priceupdate_status, \
|
| 60 |
update_item_hold_inventory, update_nlc_at_marketplaces, get_all_flipkart_items
|
60 |
update_item_hold_inventory, update_nlc_at_marketplaces, get_all_flipkart_items, get_flipkart_item, \
|
| - |
|
61 |
add_or_update_flipkart_item, get_flipkart_item_detail, get_flipkart_items, search_flipkart_items, \
|
| - |
|
62 |
get_count_for_flipkart_items, get_flipkart_search_result_count, get_all_fk_items
|
| 61 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
63 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status
|
| 62 |
from shop2020.utils.Utils import log_entry, to_py_date
|
64 |
from shop2020.utils.Utils import log_entry, to_py_date
|
| 63 |
import datetime
|
65 |
import datetime
|
| 64 |
|
66 |
|
| 65 |
class CatalogServiceHandler:
|
67 |
class CatalogServiceHandler:
|
| Line 105... |
Line 107... |
| 105 |
close_session()
|
107 |
close_session()
|
| 106 |
return result
|
108 |
return result
|
| 107 |
|
109 |
|
| 108 |
def addBanner(self, bannerCongregate):
|
110 |
def addBanner(self, bannerCongregate):
|
| 109 |
try:
|
111 |
try:
|
| 110 |
add_banner(bannerCongregate)
|
112 |
return add_banner(bannerCongregate)
|
| 111 |
finally:
|
113 |
finally:
|
| 112 |
close_session()
|
114 |
close_session()
|
| 113 |
|
115 |
|
| 114 |
def getAllBanners(self):
|
116 |
def getAllBanners(self):
|
| 115 |
bannerList=[]
|
117 |
bannerList=[]
|
| Line 135... |
Line 137... |
| 135 |
finally:
|
137 |
finally:
|
| 136 |
close_session()
|
138 |
close_session()
|
| 137 |
return result
|
139 |
return result
|
| 138 |
|
140 |
|
| 139 |
def getActiveBanners(self):
|
141 |
def getActiveBanners(self):
|
| - |
|
142 |
active_banners = {}
|
| 140 |
try:
|
143 |
try:
|
| 141 |
active_banners = get_active_banners()
|
144 |
active_banners = get_active_banners()
|
| 142 |
for bannerName,banners in active_banners.iteritems():
|
- |
|
| 143 |
active_banners[bannerName] = to_t_banner_list(banners)
|
- |
|
| 144 |
finally:
|
145 |
finally:
|
| 145 |
close_session()
|
146 |
close_session()
|
| 146 |
return active_banners
|
147 |
return active_banners
|
| 147 |
|
148 |
|
| 148 |
def addBannerMap(self, bannerMaps):
|
149 |
def addBannerMap(self, bannerMaps):
|
| Line 216... |
Line 217... |
| 216 |
finally:
|
217 |
finally:
|
| 217 |
close_session()
|
218 |
close_session()
|
| 218 |
return campaigns
|
219 |
return campaigns
|
| 219 |
|
220 |
|
| 220 |
def getActiveBannersForMobileSite(self):
|
221 |
def getActiveBannersForMobileSite(self):
|
| - |
|
222 |
active_banners = {}
|
| 221 |
try:
|
223 |
try:
|
| 222 |
active_banners = get_active_banners_for_mobile_site()
|
224 |
active_banners = get_active_banners_for_mobile_site()
|
| 223 |
for bannerName,banners in active_banners.iteritems():
|
225 |
for bannerName,banners in active_banners.iteritems():
|
| 224 |
active_banners[bannerName] = to_t_banner_list(banners)
|
226 |
active_banners[bannerName] = to_t_banner_list(banners)
|
| 225 |
finally:
|
227 |
finally:
|
| Line 1422... |
Line 1424... |
| 1422 |
def getAllFlipkartItems(self):
|
1424 |
def getAllFlipkartItems(self):
|
| 1423 |
try:
|
1425 |
try:
|
| 1424 |
return [to_t_flipkart_item(item) for item in get_all_flipkart_items()]
|
1426 |
return [to_t_flipkart_item(item) for item in get_all_flipkart_items()]
|
| 1425 |
finally:
|
1427 |
finally:
|
| 1426 |
close_session()
|
1428 |
close_session()
|
| - |
|
1429 |
|
| - |
|
1430 |
def getFlipkartItem(self,item_id):
|
| - |
|
1431 |
try:
|
| - |
|
1432 |
return to_t_flipkart_item(get_flipkart_item(item_id))
|
| - |
|
1433 |
finally:
|
| - |
|
1434 |
close_session()
|
| - |
|
1435 |
|
| - |
|
1436 |
def addOrUpdateFlipkartItem(self,flipkartitem):
|
| - |
|
1437 |
try:
|
| - |
|
1438 |
return add_or_update_flipkart_item(flipkartitem)
|
| - |
|
1439 |
finally:
|
| - |
|
1440 |
close_session()
|
| - |
|
1441 |
|
| - |
|
1442 |
def getFlipkartItemDetails(self,item_id):
|
| - |
|
1443 |
try:
|
| - |
|
1444 |
flipkartitem, flipkartInventory = get_flipkart_item_detail(item_id)
|
| - |
|
1445 |
return to_t_flipkart_item_details(flipkartitem, flipkartInventory)
|
| - |
|
1446 |
finally:
|
| - |
|
1447 |
close_session()
|
| - |
|
1448 |
|
| - |
|
1449 |
def getFlipkartItems(self,offset,limit):
|
| - |
|
1450 |
try:
|
| - |
|
1451 |
items = get_flipkart_items(offset,limit)
|
| - |
|
1452 |
return [to_t_flipkart_item_details(item,None) for item in items]
|
| - |
|
1453 |
finally:
|
| - |
|
1454 |
close_session()
|
| - |
|
1455 |
|
| - |
|
1456 |
def searchFlipkartItems(self,searchterm,offset,limit):
|
| - |
|
1457 |
try:
|
| - |
|
1458 |
flipkartitems = []
|
| - |
|
1459 |
search_result = search_flipkart_items(searchterm,offset,limit)
|
| - |
|
1460 |
for flipkartitem in search_result:
|
| - |
|
1461 |
flipkartitems.append(to_t_flipkart_item_details(flipkartitem,None))
|
| - |
|
1462 |
finally:
|
| - |
|
1463 |
close_session()
|
| - |
|
1464 |
return flipkartitems
|
| - |
|
1465 |
|
| - |
|
1466 |
def getCountForFlipkartItems(self):
|
| - |
|
1467 |
try:
|
| - |
|
1468 |
return get_count_for_flipkart_items()
|
| - |
|
1469 |
finally:
|
| - |
|
1470 |
close_session()
|
| - |
|
1471 |
|
| - |
|
1472 |
def getFlipkartSearchResultCount(self,searchterms):
|
| - |
|
1473 |
try:
|
| - |
|
1474 |
return get_flipkart_search_result_count(searchterms)
|
| - |
|
1475 |
finally:
|
| - |
|
1476 |
close_session()
|
| - |
|
1477 |
|
| - |
|
1478 |
def getAllFkItems(self):
|
| 1427 |
|
1479 |
try:
|
| - |
|
1480 |
return [to_t_flipkart_item_details(item,None) for item in get_all_fk_items()]
|
| - |
|
1481 |
finally:
|
| - |
|
1482 |
close_session()
|
| 1428 |
|
1483 |
|
| 1429 |
if __name__ == '__main__':
|
1484 |
if __name__ == '__main__':
|
| 1430 |
items = get_all_alive_items()
|
1485 |
items = get_all_alive_items()
|
| 1431 |
ret_items = []
|
1486 |
ret_items = []
|
| 1432 |
for item in items:
|
1487 |
for item in items:
|