2020-08-23 13:08:15 +00:00
import requests
import json
from bs4 import BeautifulSoup as b
2020-08-24 18:25:22 +00:00
import pandas as p
2020-08-23 13:08:15 +00:00
2020-08-24 18:25:22 +00:00
# keywords = input('keyword search: ')
2020-08-23 13:08:15 +00:00
2020-08-24 03:17:24 +00:00
with open ( ' cat_list.txt ' ) as jf :
cat_list = json . load ( jf )
2020-10-04 07:48:55 +00:00
finding_service = [ ' findItemsAdvanced ' , ' findCompletedItems ' , ' findItemsByKeywords ' , ' findItemsIneBayStores ' , ' findItemsByCategory ' , ' findItemsByProduct ' ]
2020-09-30 03:06:34 +00:00
pageNumber = list ( range ( 1 , 101 ) )
2020-10-04 07:48:55 +00:00
2020-08-24 18:25:22 +00:00
# departments = ["3034","93427"]
2020-10-04 07:48:55 +00:00
itemid_results_list = [ ]
for categoryID in cat_list [ 0 : 2 ] :
2020-08-23 13:08:15 +00:00
params = {
2020-08-24 18:25:22 +00:00
" OPERATION-NAME " : finding_service [ 4 ] ,
2020-10-04 07:48:55 +00:00
" SECURITY-APPNAME " : " scottbea-xlister-PRD-6796e0ff6-14862949 " ,
2020-08-23 13:08:15 +00:00
" SERVICE-VERSION " : " 1.13.0 " ,
" RESPONSE-DATA-FORMAT " : " JSON " ,
" categoryId " : categoryID ,
" paginationInput.entriesPerPage " : " 100 " ,
2020-09-30 03:06:34 +00:00
" paginationInput.PageNumber " : pageNumber [ 0 ]
2020-08-23 13:08:15 +00:00
}
2020-09-30 03:06:34 +00:00
# extract item id here for piping into shopping_test.py
2020-08-23 13:08:15 +00:00
2020-10-04 07:48:55 +00:00
response = requests . get ( " https://svcs.ebay.com/services/search/FindingService/v1 " , params = params )
2020-08-23 13:08:15 +00:00
data = response . json ( )
pretty_data = json . dumps ( data , indent = 2 )
2020-09-30 03:06:34 +00:00
# can use pandas.json_normalize(custom dict cobbled from respons.json())
2020-09-30 03:08:37 +00:00
2020-08-23 13:08:15 +00:00
# Additional problem you will run into when getting labeled data is shoe types and features not in features, accents, styles, categories or subcategories.