corrected pageNumber and service params. Need to fix typeError on line 24-27
This commit is contained in:
parent
acb5955b97
commit
12f4770eaf
19
ebay_api.py
19
ebay_api.py
@ -9,29 +9,33 @@ big_data = pd.read_csv('big_data.csv')
|
||||
|
||||
class FindingApi:
|
||||
'''Some docstring to get rid of linting errors'''
|
||||
def __init__(self):
|
||||
def __init__(self, service, pageNumber):
|
||||
self.service = [
|
||||
'findItemsAdvanced', 'findCompletedItems',
|
||||
'findItemsByKeywords', 'findItemsIneBayStores', 'findItemsByCategory',
|
||||
'findItemsByProduct'
|
||||
]
|
||||
self.pageNumber = list(range(1, 63))
|
||||
][service]
|
||||
self.pageNumber = list(range(1, pageNumber)) # 64 pages is recommended
|
||||
# this will give equal weights to cats given call restraints
|
||||
|
||||
# departments = ["3034","93427"] (womens and mens)
|
||||
|
||||
def get_ids_from_cats(self):
|
||||
'''Stop bothering me for docstrings.'''
|
||||
'''
|
||||
get_ids_from cats creates a 20-itemId list to use for the ShoppingApi
|
||||
call
|
||||
'''
|
||||
itemid_results_list = []
|
||||
for category_id in cat_list:
|
||||
for i in self.pageNumber:
|
||||
params = {
|
||||
"OPERATION-NAME":self.service[4],
|
||||
"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":self.pageNumber[i]
|
||||
"paginationInput.PageNumber":i # might need to change this
|
||||
}
|
||||
response = requests.get("https://svcs.ebay.com/services/search/FindingService/v1",
|
||||
params=params)
|
||||
@ -46,7 +50,8 @@ class FindingApi:
|
||||
|
||||
class ShoppingApi(FindingApi):
|
||||
'''
|
||||
I don't need no stinkin' dockstring, foo
|
||||
Creates objects from ShoppingApi service calls that can interact with
|
||||
pandas dataframes
|
||||
'''
|
||||
def get_item_from_findItemsByCategory(self, item_id_results):
|
||||
for twenty_id in item_id_results:
|
||||
|
Loading…
Reference in New Issue
Block a user