ebay-ml-lister/ebay_api_test.py
2020-08-24 11:25:22 -07:00

30 lines
1.5 KiB
Python

import requests
import json
from bs4 import BeautifulSoup as b
import pandas as p
# keywords = input('keyword search: ')
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)))
# departments = ["3034","93427"]
for categoryID in cat_list:
params = {
"OPERATION-NAME":finding_service[4],
"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.