def add_brand(brand_name, logo=None): """ Add tag to list """ log.info('Try add new brand %r', brand_name) s = PriceServices() s.add_brand(brand_name, logo)
def add_loose_tag(name): """ Add tag to list """ log.info('Try add tag %r', name) s = PriceServices() s.add_loose_tag(name)
def add_tag_to_list(name, product_id): """ Add tag to product """ log.info('Try add tag %r to product %r', name, product_id) s = PriceServices() s.add_tag_to_list(name, product_id)
def add_synonym_to_cat(category_id, word): """ Add synonym to category """ log.info('Try add word %r to category %r', word, category_id) s = PriceServices() s.add_synonym_to_category(category_id, word)
def enrich_images(enty_point_id=None): """ Run enriching images """ log.info('Run enriching images') s = PriceServices() s.enrich_images()
def try_get_next_page(url): """ Parse page without results save - using for testing parsing """ log.info('Started parase page, url: %r', url) ps = PriceServices() p = ps.test_next_page(url) # noqa F841
def list_entry_point(): """ Show all entry points """ print('Run parasing all enty points') s = PriceServices() s.get_list_entry_point()
def run_downloading(enty_point_id=None): """ Run parasing all entry point defined in price_enty_point """ print('Run parasing all enty points') s = PriceServices() s.run_entry_points(enty_point_id)
def add_entry_point(entry_point, category_id): """ Add entry point do db """ log.info('Try add entry point %r %r', entry_point, category_id) ps = PriceServices() p = ps.add_entry_point(entry_point, category_id) # noqa F841
def list_category(): """ Show all category """ log.info('All category:') s = PriceServices() s.get_list_category()
def try_parse_page(url): """ Parse page without results save - using for testing parsing """ log.info('Started parase page, url: %r', url) ps = PriceServices() p = ps.visit_site(url) for items in p.entity: log.info(items)
def parse_ofert(ofert_id=None, shop_id=None): """ Run parasing all ofert storage in price_ofert """ if ofert_id: log.info('Run parasing ofert: Ofert_id:{}'.format(ofert_id)) elif shop_id: log.info('Run parasing ofert: Shop_id:{}'.format(shop_id)) else: log.info('Run parasing all oferts') s = PriceServices() s.parase_ofert(ofert_id, shop_id)
def c_tags_product(ofert_id=None, shop_id=None, entry_point_id=None, date_scan=None): ps = PriceServices() for lp, ofert in ps.get_ofert_for_tags(ofert_id=None, shop_id=None, entry_point_id=None, scan_date=None): if lp % 1000 == 0: log.info('Order ofert no: {}'.format(lp)) tag_paraser.delay(sa_obj_to_dict(ofert)) log.info('Order {} pferts'.format(lp))
def tags_ofert(ofert_id=None, shop_id=None, entry_point_id=None, date_scan=None): scan_date = date_scan """ Run tags ofert """ if ofert_id: log.info('Run parasing ofert: Ofert_id:{}'.format(ofert_id)) elif shop_id: log.info('Run parasing ofert: Shop_id:{}'.format(shop_id)) elif entry_point_id: log.info( 'Run parasing ofert: Entry_Point_id:{}'.format(entry_point_id)) elif scan_date: log.info('Run parasing ofert: Scan Date: :{}'.format(scan_date)) else: log.info('Run parasing all oferts') s = PriceServices() s.tags_ofert(ofert_id, shop_id, entry_point_id, scan_date)
def get(self): s = Services() return s.get_price_menu()
def get(self, shop_id): s = Services() return s.get_shop_name(shop_id)
def get(self, entry_point_id): s = Services() return s.get_shop_id(entry_point_id)
def download_catalog(entry_point_id): s = PriceServices() s.run_entry_points(entry_point_id)
def send_notification(): s = PriceServices() s.send_notification()