From 0cf8d768bb5e9fcd88de20ce312cd0af26a6d473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Mart=C3=ADn?= Date: Thu, 10 Sep 2015 23:22:58 +0200 Subject: [PATCH] fetch_prices iterator fix --- amiibofindr/apps/amiibo/management/commands/fetch_price.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amiibofindr/apps/amiibo/management/commands/fetch_price.py b/amiibofindr/apps/amiibo/management/commands/fetch_price.py index 136db11..ec7fbe2 100644 --- a/amiibofindr/apps/amiibo/management/commands/fetch_price.py +++ b/amiibofindr/apps/amiibo/management/commands/fetch_price.py @@ -25,14 +25,14 @@ class Command(BaseCommand): check_price=True).values_list('item_id', flat=True) amazon = Crawler(region[1]) products = amazon.fetch_batch(item_codes) - if isinstance(products, list): + try: for product in products: amiibo_shop = AmiiboShop.objects.get( item_id=product['shop_product_id'], shop__flag_code=region[0] ) amiibo_shop.update_price(product['price'], product['currency']) - else: + except TypeError: amiibo_shop = AmiiboShop.objects.get( item_id=product['shop_product_id'], shop__flag_code=region[0]