def send_notifications(): new_products = Product.get_new() telegram = TelegramBot() for product in new_products: p: Product = product try: telegram.send_notification(p.image, p.title, p.description, p.price, p.city, p.region, p.url) p.is_new = False session.commit() except: logging.exception( f"Error while notifying user about product {p.olx_id} - {p.title}" )
def _check_pending_products(): query = Product.get_new().count() if query != 0: logging.getLogger(__name__).error( "Pending products during start of spider")