diff --git a/ebay_api_test.py b/ebay_api_test.py index 872ff78..6e2e7df 100644 --- a/ebay_api_test.py +++ b/ebay_api_test.py @@ -3,40 +3,25 @@ import json from bs4 import BeautifulSoup as b -# with open('cat_list') as jf: -# cat_list = json.load(jf) +with open('cat_list.txt') as jf: + cat_list = json.load(jf) +finding_service = ['findItemsByCategory', 'getHistograms'] departments = ["3034","93427"] # keywords = input('keyword search: ') -for categoryID in departments: +for categoryID in cat_list: params = { - "OPERATION-NAME":"findItemsByCategory", + "OPERATION-NAME":finding_service[0], "SECURITY-APPNAME":"scottbea-xlister-PRD-6796e0ff6-14862949", "SERVICE-VERSION":"1.13.0", "RESPONSE-DATA-FORMAT":"JSON", "categoryId":categoryID , "paginationInput.entriesPerPage":"100", - "outputSelector":"AspectHistogram" } response = requests.get("https://svcs.ebay.com/services/search/FindingService/v1", params=params) # data = response.json() pretty_data = json.dumps(data, indent=2) - -# header_dict = dict(response.headers) -# pretty_header = json.dumps(header_dict, indent=2) - -# results = data['findItemsByCategoryResponse'][0]['searchResult'][0]['item'] - - - -# Before moving onto to the Trading api make sure you check to see if the Finding api will -# output the labels you need. Look into "outputselector" and "aspectfilter" on the -# Finding api --> "finditembykeyword" or other specific calls - - -# I think you'll have to paginate the results to output an aspecthistogram cause you might be getting too many results per call. +# ebay has not patched their aspectHistogram bug so it's not getting returned. Additionally, the findItemsByCategory service call doesn't support detail levels which means it can't return item specifics. So, you will have to conduct a finding api call with the category IDs and then pipe the resulting itemIDs into the finding api to get the item specifics n whatnot. FRom this info you can get your labels # Additional problem you will run into when getting labeled data is shoe types and features not in features, accents, styles, categories or subcategories. - -# Also, if you can filter by category ids after conducting a very broad search maybe that will be a good way to return the aspect histogram. But you may have to just to a search for each ctegory and return the item specifics, create a giant pandas df and find make a list from the unique specifics/ labels \ No newline at end of file