From e63ced82ae4913450153bdb2bf6d5733af9c1fe0 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Tue, 28 May 2019 13:06:19 +0200 Subject: [PATCH] Fix price --- manuels/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manuels/views.py b/manuels/views.py index a3cff46..46a2c50 100644 --- a/manuels/views.py +++ b/manuels/views.py @@ -306,9 +306,11 @@ def isbn_api(request, isbn): authors = authors.getText().strip() price = decitre_soup.select('.product-add-to-cart-wrapper div.price span.final-price') + logger.info(f'Fonud price {price}') if price: price = price[0] price = price.getText().replace('€', '').replace(',', '.').strip() + logger.info(f'Final price {price}') year = None editor = None @@ -324,7 +326,7 @@ def isbn_api(request, isbn): 'title': title, 'authors': authors, 'isbn': isbn, - 'price': float(price), + 'price': float(price) if price else None, 'year': year, 'editor': editor, })