Beispiel #1
0
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)
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
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)
Beispiel #5
0
def enrich_images(enty_point_id=None):
    """
    Run enriching images
    """
    log.info('Run enriching images')
    s = PriceServices()
    s.enrich_images()
Beispiel #6
0
def add_loose_tag(name):
    """
    Add tag to list
    """
    log.info('Try add tag %r', name)
    s = PriceServices()
    s.add_loose_tag(name)
Beispiel #7
0
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)
Beispiel #8
0
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)
Beispiel #9
0
def list_category():
    """
    Show all category
    """
    log.info('All category:')
    s = PriceServices()
    s.get_list_category()
Beispiel #10
0
def list_entry_point():
    """
    Show all entry points
    """
    print('Run parasing all enty points')
    s = PriceServices()
    s.get_list_entry_point()
Beispiel #11
0
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)
Beispiel #12
0
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)
Beispiel #13
0
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))
Beispiel #14
0
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)
Beispiel #15
0
def download_catalog(entry_point_id):
    s = PriceServices()
    s.run_entry_points(entry_point_id)
Beispiel #16
0
def send_notification():
    s = PriceServices()
    s.send_notification()