From 904014ea38103f6b29c8a48d7582accb1981fb3f Mon Sep 17 00:00:00 2001 From: spbeach46 Date: Fri, 30 Oct 2020 21:55:40 -0700 Subject: [PATCH] added conditional to check if item id in both item_id_results_list and in local file to eliminate variations listings including written data --- ebay_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ebay_api.py b/ebay_api.py index a1031b3..9e82d96 100644 --- a/ebay_api.py +++ b/ebay_api.py @@ -45,12 +45,12 @@ class FindingApi: try:# TODO run pdb here to see how to extract itemId before update_df training = pd.read_csv('training.csv') for item in data['findItemsByCategoryResponse'][0]['searchResult'][0]['item']: - if item not in training.values not in itemid_results_list:# TODO need to figure out syntax to check if item_id is present in both list and training set. (list to avoid repeat results) + if (item not in training.values) and (item not in itemid_results_list): itemid_results_list.append(item['itemId'][0]) # itemId # values are in lists for some reason except (pd.errors.EmptyDataError, FileNotFoundError): for item in data['findItemsByCategoryResponse'][0]['searchResult'][0]['item']: - if item not in itemid_results_list: + if (item not in training.values) and (item not in itemid_results_list): itemid_results_list.append(item['itemId'][0]) item_id_results = [','.join(itemid_results_list[n:n+20]) for n in list(range(0, len(itemid_results_list), 20))]