diff --git a/shopping_api.py b/shopping_api.py index 25651d5..49d1a29 100644 --- a/shopping_api.py +++ b/shopping_api.py @@ -10,28 +10,29 @@ big_data = pd.read_csv('big_data.csv') class FindingApi: '''Some docstring to get rid of linting errors''' - finding_service = [ - 'findItemsAdvanced', 'findCompletedItems', - 'findItemsByKeywords', 'findItemsIneBayStores', 'findItemsByCategory', - 'findItemsByProduct' - ] - pageNumber = list(range(1, 63)) + def __init__(self): + self.service = [ + 'findItemsAdvanced', 'findCompletedItems', + 'findItemsByKeywords', 'findItemsIneBayStores', 'findItemsByCategory', + 'findItemsByProduct' + ] + self.pageNumber = list(range(1, 63)) # departments = ["3034","93427"] (womens and mens) def get_ids_from_cats(self): '''Stop bothering me for docstrings.''' - self.itemid_results_list = [] + itemid_results_list = [] for category_id in cat_list: - for i in FindingApi.pageNumber: + for i in self.pageNumber: params = { - "OPERATION-NAME":FindingApi.finding_service[4], + "OPERATION-NAME":self.service[4], "SECURITY-APPNAME":"scottbea-xlister-PRD-6796e0ff6-14862949", "SERVICE-VERSION":"1.13.0", "RESPONSE-DATA-FORMAT":"JSON", "categoryId":category_id, "paginationInput.entriesPerPage":"100", - "paginationInput.PageNumber":FindingApi.pageNumber[i] + "paginationInput.PageNumber":self.pageNumber[i] } response = requests.get("https://svcs.ebay.com/services/search/FindingService/v1", params=params) @@ -45,15 +46,14 @@ class FindingApi: return item_id_results class ShoppingApi(FindingApi): - self.item_id_results = FindingApi.get_ids_from_cats() - def get_item_from_findItemsByCategory(self): - for twentyId in item_id_results: + def get_item_from_findItemsByCategory(self, item_id_results): + for twenty_id in item_id_results: params = { "callname":"GetMultipleItems", "appid":"scottbea-xlister-PRD-6796e0ff6-14862949", "version":"671", "responseencoding":"JSON", - "ItemID":twentyId, # you pass in a list? If not then maybe a comma-separated + "ItemID":twenty_id, # you pass in a list? If not then maybe a comma-separated "IncludeSelector":"ItemSpecifics", }