如何用python語言獲得商品詳情資料API 返回值說明

API技術開發者 發表於 2023-01-14
Python

前言

item_get - 獲得商品詳情搜尋商品介面,可以透過關鍵詞請求介面拿到商品列表頁面的商品標題,商品價格,商品優惠價,商品影片,商品圖片,商品sku屬性,商品sku屬性描述,發貨地,庫存,商品銷量,店鋪優惠券,店鋪促銷資訊等頁面上有的資料均可以拿到,以上的資料可以用於行業資料分析,商品搬家業務,商品品牌維護,商品價格監控,商品銷量監控,代購商城等業務場景均可以用上。

請求引數

請求引數:num_iid=665595795925&is_promotion=1
引數說明:num_iid:淘寶商品ID
is_promotion:是否獲取取促銷價

請求示例

Curl PHP PHPsdk JAVA C# Python

"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
# 請求示例 url 預設請求引數已經做URL編碼
url = "您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=520813250866&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)</code>
————————————————
版權宣告:本文為CSDN博主「api_Obound」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處連結及本宣告。
原文連結:https://blog.csdn.net/api_Anzexi/article/details/128544751

響應示例

{
	"item": {
		"num_iid": "665595795925",
		"title": "SHOWGGT 秋冬季拼接假兩件夾克男女 日系復古寬鬆ins潮流外套上衣",
		"desc_short": "",
		"price": "168.00",
		"total_price": 0,
		"suggestive_price": 0,
		"orginal_price": "168.00",
		"nick": "唯物主義褲態",
		"num": "200",
		"min_num": 0,
		"detail_url": "
		"pic_url": "//img.alicdn.com/imgextra/i1/2493398400/O1CN01QSyols2BvFfGyQNnX_!!2493398400.jpg",
		"brand": "other/其他",
		"brandId": "29534",
		"rootCatId": "30",
		"cid": "201692401",
		"crumbs": [],
		"created_time": "",
		"modified_time": "",
		"delist_time": "",
		"desc": "",
		"desc_img": [],
		"item_imgs": [
			{
				"url": "//img.alicdn.com/imgextra/i1/2493398400/O1CN01QSyols2BvFfGyQNnX_!!2493398400.jpg"
			},
			{
				"url": "//img.alicdn.com/imgextra/i1/2493398400/O1CN01xqdsUt2BvFfGyQmlE_!!2493398400.jpg"
			},
			{
				"url": "//img.alicdn.com/imgextra/i2/2493398400/O1CN01EwG9zw2BvFgOQvc5H_!!2493398400.jpg"
			},
			{
				"url": "//img.alicdn.com/imgextra/i2/2493398400/O1CN01U9cjVd2BvFfXOYXfW_!!2493398400.jpg"
			},
			{
				"url": "//img.alicdn.com/imgextra/i3/2493398400/O1CN01riShC32BvFfY6l2RX_!!2493398400.jpg"
			}
		],
		"item_weight": "",
		"item_size": "",
		"location": "廣東廣州",
		"post_fee": 0,
		"express_fee": null,
		"ems_fee": "",
		"shipping_to": "",
		"has_discount": "false",
		"video": [],
		"is_virtual": "",
		"sample_id": "",
		"is_promotion": "false",
		"props_name": "20509:28318:尺碼:XXL;20509:28315:尺碼:M;20509:28316:尺碼:L;20509:28317:尺碼:XL;1627207:28341:顏色分類:黑色",
		"prop_imgs": {
			"prop_img": [
				{
					"properties": "1627207:28341",
					"url": "//img.alicdn.com/imgextra/i1/2493398400/O1CN01QSyols2BvFfGyQNnX_!!2493398400.jpg"
				}
			]
		},
		"property_alias": "",
		"props": [
			{
				"name": "品牌",
				"value": "other/其他"
			},
			{
				"name": "適用年齡",
				"value": "18-25週歲"
			},
			{
				"name": "尺碼",
				"value": "XXL,M,L,XL"
			},
			{
				"name": "風格",
				"value": "復古風"
			},
			{
				"name": "顏色分類",
				"value": "黑色"
			},
			{
				"name": "上市年份季節",
				"value": "2022年秋季"
			},
			{
				"name": "袖長",
				"value": "長袖"
			}
		],
		"total_sold": "105",
		"skus": {
			"sku": [
				{
					"price": "168",
					"total_price": 0,
					"orginal_price": "168",
					"properties": "20509:28318;1627207:28341",
					"properties_name": "20509:28318:尺碼:XXL;1627207:28341:顏色分類:黑色",
					"quantity": "194",
					"sku_id": "4923274788083"
				},
				{
					"price": "168",
					"total_price": 0,
					"orginal_price": "168",
					"properties": "20509:28315;1627207:28341",
					"properties_name": "20509:28315:尺碼:M;1627207:28341:顏色分類:黑色",
					"quantity": "129",
					"sku_id": "4923274788080"
				},
				{
					"price": "168",
					"total_price": 0,
					"orginal_price": "168",
					"properties": "20509:28316;1627207:28341",
					"properties_name": "20509:28316:尺碼:L;1627207:28341:顏色分類:黑色",
					"quantity": "150",
					"sku_id": "4923274788081"
				},
				{
					"price": "168",
					"total_price": 0,
					"orginal_price": "168",
					"properties": "20509:28317;1627207:28341",
					"properties_name": "20509:28317:尺碼:XL;1627207:28341:顏色分類:黑色",
					"quantity": "170",
					"sku_id": "4923274788082"
				}
			]
		},
		"seller_id": "2493398400",
		"sales": 100,
		"shop_id": "119206860",
		"props_list": {
			"20509:28318": "尺碼:XXL",
			"20509:28315": "尺碼:M",
			"20509:28316": "尺碼:L",
			"20509:28317": "尺碼:XL",
			"1627207:28341": "顏色分類:黑色"
		},
		"seller_info": {
			"nick": "唯物主義褲態",
			"item_score": "4.6 ",
			"score_p": "4.6 ",
			"delivery_score": "4.7 ",
			"shop_type": "C",
			"user_num_id": "2493398400",
			"sid": "119206860",
			"title": "SHOWGGT",
			"zhuy": "
			"shop_name": "SHOWGGT"
		},
		"tmall": false,
		"error": "",
		"warning": "",
		"url_log": [],
		"fav_count": "13852",
		"fans_count": "1.8萬",
		"freight": "快遞: 快遞包郵",
		"props_imgs": {
			"prop_img": [
				{
					"properties": "1627207:28341",
					"url": "//img.alicdn.com/imgextra/i1/2493398400/O1CN01QSyols2BvFfGyQNnX_!!2493398400.jpg"
				}
			]
		},
		"_ddf": "xdl",
		"promo_type": null,
		"props_img": {
			"1627207:28341": "//img.alicdn.com/imgextra/i1/2493398400/O1CN01QSyols2BvFfGyQNnX_!!2493398400.jpg"
		},
		"format_check": "ok",
		"shop_item": [],
		"relate_items": []
	},
	"error": "",
	"secache": "78f64c21516491ca25c1032251a2a32f",
	"secache_time": 1673676608,
	"secache_date": "2023-01-14 14:10:08",
	"translate_status": "",
	"translate_time": 0,
	"language": {
		"default_lang": "cn",
		"current_lang": "cn"
	},
	"reason": "",
	"error_code": "0000",
	"cache": 0,
	"api_info": "today:100 max:10100 all[348=100+98+150];expires:2030-12-31",
	"execution_time": "7.077",
	"server_time": "Beijing/2023-01-14 14:10:08",
	"client_ip": "106.6.37.73",
	"call_args": {
		"num_iid": "665595795925",
		"is_promotion": "1"
	},
	"api_type": "taobao",
	"translate_language": "zh-CN",
	"translate_engine": "baidu",
	"server_memory": "0.89MB",
	"request_id": "gw-4.63c24739cc456",
	"last_id": "1475433908"
}

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70026036/viewspace-2932211/,如需轉載,請註明出處,否則將追究法律責任。