get_item_fromfindItemsByCateogry fix. Invalid token errors persist

This commit is contained in:
scott 2022-01-04 20:50:42 -07:00
parent 7d8be32ba8
commit fc793f4456

View File

@ -64,9 +64,9 @@ class FindingApi:
"itemFilter.name":"HideDuplicateItems",
"itemFilter.value":"true",
"sortOrder":"StartTimeNewest",
"itemFilter(1).name":"TopRatedSellerOnly",
"itemFilter(1).value":"true",
}
# "itemFilter(1).name":"TopRatedSellerOnly", # TODO fix here
# "itemFilter(1).value":"true"
try:
response = requests.get("https://svcs.ebay.com/services/search/FindingService/v1",
@ -142,15 +142,6 @@ class ShoppingApi:
for department in parent_cats:
# params = {
# "callname":"GetCategoryInfo",
# "X-EBAY-API-IAF-TOKEN":cfg.sec['X-EBAY-API-IAF-TOKEN'],
# "version":"671",
# "responseencoding":"JSON",
# "CategoryID":department,
# "IncludeSelector":"ChildCategories",
# }
headers = {
"X-EBAY-API-IAF-TOKEN":cfg.sec['X-EBAY-API-IAF-TOKEN'], # TODO implement auto oauth token renewal
"version":"671",
@ -174,8 +165,6 @@ class ShoppingApi:
with open('cat_list.txt', 'w') as f:
json.dump(cat_list, f)
# leaf_list = [node['LeafCategory'] for node in response]
def get_item_from_findItemsByCategory(self, twenty_id):
'''
@ -218,11 +207,11 @@ class ShoppingApi:
data = []
try:
with open('item_id_results.txt') as f:
with open('item_id_results.txt') as f: # TODO fix here
item_id_results = json.load(f)
except (FileNotFoundError, ValueError):
item_id_results = scrape_ids.main()
item_id_results = scrape_ids.main()# TODO fix here
with concurrent.futures.ThreadPoolExecutor() as executor:
for future in executor.map(self.get_item_from_findItemsByCategory, item_id_results):