From 9d02381140e71701d7de92ecd7ac059cd6e7b552 Mon Sep 17 00:00:00 2001 From: spbeach46 Date: Thu, 8 Oct 2020 03:07:41 -0700 Subject: [PATCH] completed conditional to check for itemId existence in csv data and 20-itemId string list generator --- shopping_api.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/shopping_api.py b/shopping_api.py index 5591078..707a653 100644 --- a/shopping_api.py +++ b/shopping_api.py @@ -14,9 +14,9 @@ class FindingApi: ] pageNumber = list(range(1, 63)) - # departments = ["3034","93427"] + # departments = ["3034","93427"] (womens and mens) - def get_ids(self): + def get_ids_from_cats(): itemid_results_list = [] for category_id in cat_list: for i in FindingApi.pageNumber: @@ -29,20 +29,17 @@ class FindingApi: "paginationInput.entriesPerPage":"100", "paginationInput.PageNumber":FindingApi.pageNumber[i] } - # extract item id here for piping into shopping_test.py - response = requests.get("https://svcs.ebay.com/services/search/FindingService/v1", params=params) data = response.json() for item in data['findItemsByCategoryResponse'][0]['searchResult'[0]['item']: itemid_results_list.append(item['itemId']) # above this line you will have to check whether the id exists in the pandas dataframe before you go on to create your list for the shopping #api: check df --> if does not exist, append itemId to itemid_results_list --> with curated list, make a list of 20-itemId lists. - item_id_results = list(map(str, itemid_results_list)) - item_id_results = ','.join(item_id_results) # you will have to split this into 20 item lists strings to feed into ItemID param. Consider making a list of str lists. + item_id_results = ','.join(item_id_results_list) # you will have to split this into 20 item lists strings to feed into ItemID param. Consider making a list of str lists. return item_id_results class ShoppingApi: - def get_item(self): + def get_item_from_findItemsByCategory(): params = { "callname":"GetMultipleItems",