ebay-ml-lister/ebay_api_test.py
2020-09-29 20:08:37 -07:00

33 lines
1.3 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)))
pageNumber = list(range(1,101))
# departments = ["3034","93427"]
item_results_list = []
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",
"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()
pretty_data = json.dumps(data, indent=2)
# 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.