added get_data method for easier debugging. Added zeroth index term to ...['itemId']
This commit is contained in:
parent
12f4770eaf
commit
68f1341012
20
ebay_api.py
20
ebay_api.py
@ -19,6 +19,23 @@ class FindingApi:
|
||||
# this will give equal weights to cats given call restraints
|
||||
|
||||
# departments = ["3034","93427"] (womens and mens)
|
||||
def get_data(self):
|
||||
itemid_results_list = []
|
||||
for category_id in cat_list:
|
||||
for i in self.pageNumber:
|
||||
params = {
|
||||
"OPERATION-NAME":self.service, # make sure this works as intended
|
||||
"SECURITY-APPNAME":"scottbea-xlister-PRD-6796e0ff6-14862949",
|
||||
"SERVICE-VERSION":"1.13.0",
|
||||
"RESPONSE-DATA-FORMAT":"JSON",
|
||||
"categoryId":category_id,
|
||||
"paginationInput.entriesPerPage":"100",
|
||||
"paginationInput.PageNumber":i # might need to change this
|
||||
}
|
||||
response = requests.get("https://svcs.ebay.com/services/search/FindingService/v1",
|
||||
params=params)
|
||||
data = response.json()
|
||||
return data
|
||||
|
||||
def get_ids_from_cats(self):
|
||||
'''
|
||||
@ -42,7 +59,8 @@ class FindingApi:
|
||||
data = response.json()
|
||||
for item in data['findItemsByCategoryResponse'][0]['searchResult'][0]['item']:
|
||||
if item not in big_data.values:
|
||||
itemid_results_list.append(item['itemId'])
|
||||
itemid_results_list.append(item['itemId'][0]) # itemId
|
||||
# values are in lists for some reason
|
||||
item_id_results = [','.join(itemid_results_list[n:n+20]) for n in list(range(0,
|
||||
len(itemid_results_list), 20))]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user