| Line 13... |
Line 13... |
| 13 |
to_t_marketplace_itemprice, to_t_marketplacepercentage, to_t_flipkart_item, \
|
13 |
to_t_marketplace_itemprice, to_t_marketplacepercentage, to_t_flipkart_item, \
|
| 14 |
to_t_flipkart_item_details, to_t_market_place_history, to_t_private_deal, \
|
14 |
to_t_flipkart_item_details, to_t_market_place_history, to_t_private_deal, \
|
| 15 |
to_t_amazonoutofsync, to_t_private_deals_comparison, \
|
15 |
to_t_amazonoutofsync, to_t_private_deals_comparison, \
|
| 16 |
to_t_snapdeal_marketplace_item, to_t_flipkart_marketplace_item, \
|
16 |
to_t_snapdeal_marketplace_item, to_t_flipkart_marketplace_item, \
|
| 17 |
to_t_competitor_pricing, to_t_amazon_promotion, to_t_Amazonlisted_promo, \
|
17 |
to_t_competitor_pricing, to_t_amazon_promotion, to_t_Amazonlisted_promo, \
|
| 18 |
to_t_hsItem
|
18 |
to_t_hsItem, to_t_bulk_pricing
|
| 19 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
19 |
from shop2020.model.v1.catalog.impl.DataAcessors import add_item, retire_item, \
|
| 20 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
20 |
change_item_status, get_item, get_all_items, get_all_items_by_status, \
|
| 21 |
update_item, start_item_on, close_session, retire_item_on, \
|
21 |
update_item, start_item_on, close_session, retire_item_on, \
|
| 22 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
22 |
get_items_by_catalog_id, get_best_deals, get_best_deals_catalog_ids, \
|
| 23 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
23 |
get_best_deals_count, get_best_sellers, get_latest_arrivals, \
|
| Line 79... |
Line 79... |
| 79 |
get_previous_competitor_scraping, get_upload_result_by_id, add_amazon_promotion, \
|
79 |
get_previous_competitor_scraping, get_upload_result_by_id, add_amazon_promotion, \
|
| 80 |
get_amazon_promotion, update_amazon_promotion, get_vat_rates, \
|
80 |
get_amazon_promotion, update_amazon_promotion, get_vat_rates, \
|
| 81 |
update_item_state_vat, mark_partially_active, get_ex_affiliate_item_info, \
|
81 |
update_item_state_vat, mark_partially_active, get_ex_affiliate_item_info, \
|
| 82 |
get_all_items_to_list_on_fbg, get_all_fbg_listed_items, check_services, \
|
82 |
get_all_items_to_list_on_fbg, get_all_fbg_listed_items, check_services, \
|
| 83 |
get_items, add_hs_item, get_hs_item, update_hs_item, get_pricing_for_dtr, \
|
83 |
get_items, add_hs_item, get_hs_item, update_hs_item, get_pricing_for_dtr, \
|
| 84 |
get_all_items_to_list_on_fbd, get_all_fbd_listed_items
|
84 |
get_all_items_to_list_on_fbd, get_all_fbd_listed_items, \
|
| - |
|
85 |
get_bulk_pricing_for_items, add_bulk_pricing_for_item, get_bulk_pricing_by_item_id, \
|
| - |
|
86 |
delete_bulk_pricing_for_item_by_id , delete_bulk_pricing_for_item
|
| 85 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, \
|
87 |
from shop2020.thriftpy.model.v1.catalog.ttypes import status, \
|
| 86 |
CatalogServiceException
|
88 |
CatalogServiceException
|
| 87 |
from shop2020.utils.Utils import log_entry, to_py_date
|
89 |
from shop2020.utils.Utils import log_entry, to_py_date
|
| 88 |
import datetime
|
90 |
import datetime
|
| 89 |
|
91 |
|
| Line 1793... |
Line 1795... |
| 1793 |
ret_items.append(to_t_Amazonlisted(item))
|
1795 |
ret_items.append(to_t_Amazonlisted(item))
|
| 1794 |
return ret_items
|
1796 |
return ret_items
|
| 1795 |
finally:
|
1797 |
finally:
|
| 1796 |
close_session()
|
1798 |
close_session()
|
| 1797 |
|
1799 |
|
| - |
|
1800 |
def getBulkPricingForItems(self,itemIds):
|
| - |
|
1801 |
try:
|
| - |
|
1802 |
return get_bulk_pricing_for_items(itemIds)
|
| - |
|
1803 |
except:
|
| - |
|
1804 |
return {}
|
| - |
|
1805 |
finally:
|
| - |
|
1806 |
close_session()
|
| - |
|
1807 |
|
| - |
|
1808 |
def addBulkPricingForItem(self, bulkItemPricing):
|
| - |
|
1809 |
try:
|
| - |
|
1810 |
return to_t_bulk_pricing(add_bulk_pricing_for_item(bulkItemPricing))
|
| - |
|
1811 |
finally:
|
| - |
|
1812 |
close_session()
|
| - |
|
1813 |
|
| - |
|
1814 |
def getBulkPricingByItemId(self, itemId):
|
| - |
|
1815 |
try:
|
| - |
|
1816 |
bulkPricingItems = get_bulk_pricing_by_item_id(itemId)
|
| - |
|
1817 |
return [to_t_bulk_pricing(bulkPricingItem) for bulkPricingItem in bulkPricingItems]
|
| - |
|
1818 |
finally:
|
| - |
|
1819 |
close_session()
|
| - |
|
1820 |
|
| - |
|
1821 |
def deleteBulkPricingForItemById(self,id):
|
| - |
|
1822 |
try:
|
| - |
|
1823 |
return delete_bulk_pricing_for_item_by_id(id)
|
| - |
|
1824 |
finally:
|
| - |
|
1825 |
close_session()
|
| - |
|
1826 |
|
| - |
|
1827 |
def deleteBulkPricingForItem(self,itemId):
|
| - |
|
1828 |
try:
|
| - |
|
1829 |
return delete_bulk_pricing_for_item(itemId)
|
| - |
|
1830 |
except:
|
| - |
|
1831 |
return False
|
| - |
|
1832 |
finally:
|
| - |
|
1833 |
close_session()
|
| - |
|
1834 |
|
| - |
|
1835 |
|
| - |
|
1836 |
|
| 1798 |
if __name__ == '__main__':
|
1837 |
if __name__ == '__main__':
|
| 1799 |
items = get_all_alive_items()
|
1838 |
c = CatalogServiceHandler()
|
| 1800 |
ret_items = []
|
1839 |
bulk_items= c.getBulkPricingForItems([10,21028])
|
| 1801 |
for item in items:
|
1840 |
for k,y in bulk_items.iteritems():
|
| 1802 |
if item:
|
1841 |
print k,
|
| 1803 |
ret_items.append(to_t_item(item))
|
- |
|
| 1804 |
print ret_items
|
1842 |
print '\t',
|
| 1805 |
|
1843 |
print y
|
| 1806 |
|
1844 |
|
| 1807 |
def is_valid(item):
|
1845 |
def is_valid(item):
|
| 1808 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
1846 |
if item.status in [status.ACTIVE, status.PAUSED, status.PAUSED_BY_RISK]:
|
| 1809 |
if item.startDate:
|
1847 |
if item.startDate:
|
| 1810 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|
1848 |
return not(datetime.datetime.now() < item.startDate or item.sellingPrice == 0)
|