Annotate products that could not be found by scrapers

This commit is contained in:
polyfloyd 2025-04-21 11:29:27 +02:00
parent d69f35cfcc
commit 650aef9794
3 changed files with 32 additions and 3 deletions

View file

@ -78,6 +78,11 @@ def update_product_pricings(src):
logging.debug('no auto update: "%s"', product.description)
lines_out.append(line)
continue
except scrapers.ProductNotFoundError:
logging.warn('not found "%s"', product.description)
product.metadata['err'] = 'not_found'
lines_out.append(product.format_line())
continue
except Exception as err:
logging.error('did not update "%s": %s', product.description, err)
lines_out.append(line)
@ -92,6 +97,9 @@ def update_product_pricings(src):
previous_price = product.price
product.price = (unit_price * 20).quantize(Decimal('1'), rounding=ROUND_UP) / 20
if 'err' in product.metadata:
del product.metadata['err']
lines_out.append(product.format_line())
logging.debug(f'Found "{prod_info.name}", buy €{prod_info.price/prod_info.units:.2f}, sell €{product.price:.2f}')