Example of Taobao Commodity API usage: How to obtain Taobao Commodity Price and Sales Master Map detail data by calling an external API

The amount of product information on Taobao is very large, and the detailed information of the products is also very complete. How to obtain information such as product price and sales master image details in batches by calling an external API? I just finished a complete Taobao product collection project last week, and I am here to share it today.

Interface name: item_get

Request address: https://api-test.cn/taobao/item_get

result_type: [json, jsonu, xml, serialize, var_export] returns the data format, the default is json, and the content output by jsonu can be read directly in Chinese

request parameters

Request parameters: num_iid=652874751412&is_promotion=1

Parameter description: num_iid: Taobao product ID
is_promotion: whether to get the promotion price

 API test page

Request code (CURL, PHP, Java, JavaScript, Python, Ruby, c, c++, etc.) 

# coding:utf-8
"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
# 请求示例 url 默认请求参数已经做URL编码
url = "https://api-服务器.cn/taobao/item_get/?key=t3015935152&secret=4zTbjQ6yV748ceYa&num_iid=564893183751&is_promotion=1"
headers = {
    "Accept-Encoding": "gzip",
    "Connection": "close"
}
if __name__ == "__main__":
    r = requests.get(url, headers=headers)
    json_obj = r.json()
    print(json_obj)

example response

 

Guess you like

Origin blog.csdn.net/Jernnifer_mao/article/details/132582360