YahooShoppingAPI
https://developer.yahoo.co.jp/webapi/shopping/shopping/v3/itemsearch.html
動画で書いたコード
import json import pprint import configparser from pathlib import Path import requests BASE_DIR = Path(__file__).resolve().parent.parent config_ini = configparser.ConfigParser() config_ini.read(BASE_DIR / "setting" / "config.ini", encoding='utf-8') APP_ID = config_ini['YAHOO_SHOPPING_SETTING']['ID'] #ID yahooShoppingURL = "https://shopping.yahooapis.jp/ShoppingWebService/V3/itemSearch" #API REQUEST def search(keyword, index=1): res = requests.get(yahooShoppingURL, {"appid":APP_ID, "query":keyword}).json() return res['hits'][index]['name'] # search(keyword="NC-A57-K", index=1)
コメント