From ed4b39b3860e3fb40c96309577ec60d8a5087e9f Mon Sep 17 00:00:00 2001 From: spbeach46 Date: Tue, 29 Sep 2020 20:06:34 -0700 Subject: [PATCH] deleted some useless stuff --- ebay_api_test.py | 11 ++++++++++- shopping_test.py | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 shopping_test.py diff --git a/ebay_api_test.py b/ebay_api_test.py index 7747fb0..6f2a946 100644 --- a/ebay_api_test.py +++ b/ebay_api_test.py @@ -8,8 +8,9 @@ import pandas as p with open('cat_list.txt') as jf: cat_list = json.load(jf) finding_service = ['findItemsAdvanced', 'findCompletedItems', 'findItemsByKeywords', 'findItemsIneBayStores', 'findItemsByCategory', 'findItemsByProduct'] # list(set(re.findall(r'find\w+', response.text))) +pageNumber = list(range(1,101)) # departments = ["3034","93427"] - +item_results_list = [] for categoryID in cat_list: params = { "OPERATION-NAME":finding_service[4], @@ -18,7 +19,9 @@ for categoryID in cat_list: "RESPONSE-DATA-FORMAT":"JSON", "categoryId":categoryID , "paginationInput.entriesPerPage":"100", + "paginationInput.PageNumber":pageNumber[0] } + # 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() @@ -26,4 +29,10 @@ for categoryID in cat_list: # 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 +# The main trick to getting labeled data is going to be smoothly going from findItemsByCategory ---> pandas df or csv file with the addresses to the images being stored on local hard drive. During this operation you will have to either download the images to the local drive first and then have that location be the csv input data OR you will have to do that second by using the url to the image as input and then converting that to a local address. + +# First pipe item IDs from findItemsByCategory service into either GetSingleItem or GetMultipleItems service from shopping api call inorder to get min number of required data such as item specifics and picture urls. + +# can use pandas.json_normalize(custom dict cobbled from respons.json()) + # Additional problem you will run into when getting labeled data is shoe types and features not in features, accents, styles, categories or subcategories. diff --git a/shopping_test.py b/shopping_test.py new file mode 100644 index 0000000..13145d9 --- /dev/null +++ b/shopping_test.py @@ -0,0 +1,19 @@ +import requests +import json +from bs4 import BeautifulSoup as b + + +params = { + "callname":"GetMultipleItems", + "appid":"scottbea-xlister-PRD-6796e0ff6-14862949", + "version":"671", + "responseencoding":"JSON", + "ItemID":'184228756721', # you pass in a list? If not then maybe a comma-separated + "IncludeSelector":"ItemSpecifics", + } + +response = requests.get("https://open.api.ebay.com/shopping?", params=params) # +data = response.json() +pretty_data = json.dumps(data, indent=2) + +# departments = ["3034","93427"]