8-2 出現錯誤想請問如何解決~
使用方法
items_json = request_shopee(keyword = '運動內衣', page = 0)
items = {} #print(items_json) for i in range(len(items_json)): items[i] = items_json[i]['item_basic']
items
====>
TypeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_12424\4043242175.py in
TypeError: string indices must be integers
感謝回饋~ 目前正在解決中
請問有新的進度嗎~目前8-2還是錯誤中!
KeyError Traceback (most recent call last)
KeyError: 'items'
剛剛試 我也是遇到一樣情況KeyError: 'items' 是不是現在Shopee Open API v4是要跟shopee申請與註冊 ? 如果是 圖隊應該要重寫爬shopee商品頁的方式 而不是靠API 另外8-2是這本書STP最重要的開頭 這個fail 其他人根本沒法接下去學啦?
#專門用來請求蝦皮的相關商品基本資料
def request_shopee(keyword, page):
url = 'https://shopee.tw/api/v4/search/search_items?by=relevancy&keyword=' + keyword + '&limit=60&newest=' + str(page*60) + '&order=desc&page_type=search&scenario=PAGE_GLOBAL_SEARCH&version=2'
#開始請求