ebay-ml-lister/ebay_api_test.py
2020-08-23 20:17:24 -07:00

28 lines
1.3 KiB
Python

import requests
import json
from bs4 import BeautifulSoup as b
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 cat_list:
params = {
"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",
}
response = requests.get("https://svcs.ebay.com/services/search/FindingService/v1", params=params) #
data = response.json()
pretty_data = json.dumps(data, indent=2)
# 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.