【淘宝API接口开发系列】商品页面数据,接口可高并发,Python语言请求示例,其他语言请求示例可进参考

首先以taobao商品数据为例

【淘宝API接口开发系列】商品页面数据,接口可高并发,Python语言请求示例,其他语言请求示例可进参考_第1张图片

item_get-获得taobao商品详情

taobao.item_get

公共参数

名称 类型 必须 描述
key String 调用key(必须以GET方式拼接在URL中)注册Key和secret接入
secret String 调用密钥
api_name String API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等]
cache String [yes,no]默认yes,将调用缓存的数据,速度比较快
result_type String [json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读
lang String [cn,en,ru]翻译语言,默认cn简体中文
version String API版本

请求参数

请求参数:num_iid=721785451149&is_promotion=1

参数说明:num_iid:淘宝商品ID
is_promotion:是否获取取促销价

请求示例

# 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-gw.onebound.cn/taobao/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=652874751412&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)

 响应示例

{
	"item": {
		"num_iid": "721785451149",
		"title": "230530甜美风彩色欧根纱吊带连衣裙女夏季新款设计感时尚小众长裙",
		"desc_short": "",
		"price": "148",
		"total_price": 0,
		"suggestive_price": 0,
		"orginal_price": "148.00",
		"nick": "9度力旗舰店",
		"num": "200",
		"min_num": 0,
		"detail_url": "https://item.taobao.com/item.htm?id=721785451149",
		"pic_url": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01hzrAmN1SUXzc3SKIo_!!0-item_pic.jpg",
		"brand": "jiuduli/9度力",
		"brandId": "3000806269",
		"rootCatId": "124484008",
		"cid": "126498018",
		"crumbs": [],
		"created_time": "",
		"modified_time": "",
		"delist_time": "",
		"desc": "",
		"desc_img": [
			"https://img.alicdn.com/imgextra/i2/2201235902250/O1CN01YoSJh91SUXzgga6UW_!!2201235902250.jpg",
			"https://img.alicdn.com/imgextra/i3/2201235902250/O1CN01URfxht1SUXzatpqmn_!!2201235902250.jpg",
			"https://img.alicdn.com/imgextra/i3/2201235902250/O1CN01hu7Q1h1SUXzato6iC_!!2201235902250.jpg",
			"https://img.alicdn.com/imgextra/i4/2201235902250/O1CN01Dfym4W1SUXzciO0ab_!!2201235902250.png",
			"https://img.alicdn.com/imgextra/i3/2201235902250/O1CN01YOFRDO1SUXzdGYdjw_!!2201235902250.jpg",
			"https://img.alicdn.com/imgextra/i3/2201235902250/O1CN01iF76p21SUXzZWEjfS_!!2201235902250.png",
			"https://img.alicdn.com/imgextra/i3/2201235902250/O1CN01vTTd7Q1SUXzQWE9nI_!!2201235902250.jpg",
			"https://img.alicdn.com/imgextra/i1/2201235902250/O1CN01p2HXFC1SUXzelqPKt_!!2201235902250.png",
			"https://img.alicdn.com/imgextra/i3/2201235902250/O1CN01SaJNiW1SUXzZWCacu_!!2201235902250.jpg"
		],
		"item_imgs": [
			{
				"url": "https://img.alicdn.com/imgextra/i2/2201235902250/O1CN01hzrAmN1SUXzc3SKIo_!!0-item_pic.jpg"
			},
			{
				"url": "https://img.alicdn.com/imgextra/i2/2201235902250/O1CN01dks4dW1SUXzc0WOPT_!!2201235902250.jpg"
			},
			{
				"url": "https://img.alicdn.com/imgextra/i4/2201235902250/O1CN01conB0w1SUXzeISmU7_!!2201235902250.jpg"
			},
			{
				"url": "https://img.alicdn.com/imgextra/i4/2201235902250/O1CN01Ygoobe1SUXzZGewGX_!!2201235902250.jpg"
			}
		],
		"item_weight": "",
		"item_size": "",
		"location": "广东深圳",
		"post_fee": 0,
		"express_fee": null,
		"ems_fee": "",
		"shipping_to": "",
		"has_discount": "false",
		"video": {
			"url": null
		},
		"is_virtual": "",
		"sample_id": "",
		"is_promotion": "false",
		"props_name": "1627207:113243983:颜色分类:图片色S;1627207:383400229:颜色分类:图片色M;1627207:383400223:颜色分类:图片色L;1627207:478318889:颜色分类:图片色XL",
		"prop_imgs": {
			"prop_img": [
				{
					"properties": "1627207:113243983",
					"url": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg"
				},
				{
					"properties": "1627207:383400229",
					"url": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg"
				},
				{
					"properties": "1627207:383400223",
					"url": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg"
				},
				{
					"properties": "1627207:478318889",
					"url": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg"
				}
			]
		},
		"property_alias": "",
		"props": [
			{
				"name": "品牌",
				"value": "jiuduli/9度力"
			},
			{
				"name": "颜色分类",
				"value": "图片色S 图片色M 图片色L 图片色XL"
			},
			{
				"name": "性别",
				"value": "女"
			}
		],
		"total_sold": "8",
		"skus": {
			"sku": [
				{
					"price": "148",
					"total_price": 0,
					"orginal_price": "148",
					"properties": "1627207:113243983",
					"properties_name": "1627207:113243983:颜色分类:图片色S",
					"quantity": "200",
					"sku_id": "5191398702970"
				},
				{
					"price": "148",
					"total_price": 0,
					"orginal_price": "148",
					"properties": "1627207:383400229",
					"properties_name": "1627207:383400229:颜色分类:图片色M",
					"quantity": "200",
					"sku_id": "5191398702971"
				},
				{
					"price": "148",
					"total_price": 0,
					"orginal_price": "148",
					"properties": "1627207:383400223",
					"properties_name": "1627207:383400223:颜色分类:图片色L",
					"quantity": "200",
					"sku_id": "5191398702972"
				},
				{
					"price": "148",
					"total_price": 0,
					"orginal_price": "148",
					"properties": "1627207:478318889",
					"properties_name": "1627207:478318889:颜色分类:图片色XL",
					"quantity": "200",
					"sku_id": "5191398702973"
				}
			]
		},
		"seller_id": "2201235902250",
		"sales": 100,
		"shop_id": "538991164",
		"props_list": {
			"1627207:113243983": "颜色分类:图片色S",
			"1627207:383400229": "颜色分类:图片色M",
			"1627207:383400223": "颜色分类:图片色L",
			"1627207:478318889": "颜色分类:图片色XL"
		},
		"seller_info": {
			"nick": "9度力旗舰店",
			"item_score": "4.9 ",
			"score_p": "4.9 ",
			"delivery_score": "4.9 ",
			"shop_type": "B",
			"user_num_id": "2201235902250",
			"sid": "538991164",
			"title": "9度力旗舰店",
			"zhuy": "https://shop538991164.taobao.com/",
			"shop_name": "9度力旗舰店"
		},
		"tmall": true,
		"error": "",
		"warning": "",
		"url_log": [],
		"fav_count": "4488",
		"fans_count": "23.1万",
		"freight": "快递: 免运费",
		"props_imgs": {
			"prop_img": [
				{
					"properties": "1627207:113243983",
					"url": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg"
				},
				{
					"properties": "1627207:383400229",
					"url": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg"
				},
				{
					"properties": "1627207:383400223",
					"url": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg"
				},
				{
					"properties": "1627207:478318889",
					"url": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg"
				}
			]
		},
		"_ddf": "xdl",
		"promo_type": null,
		"props_img": {
			"1627207:113243983": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg",
			"1627207:383400229": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg",
			"1627207:383400223": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg",
			"1627207:478318889": "//img.alicdn.com/imgextra/i2/2201235902250/O1CN01uu3uR01SUXzZGgkVP_!!2201235902250.jpg"
		},
		"format_check": "ok",
		"shop_item": [],
		"relate_items": []
	},
	"error": "",
	"secache": "7b2f718d707d1c56fffc665f22c4e91a",
	"secache_time": 1689147922,
	"secache_date": "2023-07-12 15:45:22",
	"translate_status": "",
	"translate_time": 0,
	"language": {
		"default_lang": "cn",
		"current_lang": "cn"
	},
	"reason": "",
	"error_code": "0000",
	"cache": 0,
	"api_info": "today:299 max:10100 all[853=299+48+506];expires:2030-12-31",
	"execution_time": "2.465",
	"server_time": "Beijing/2023-07-12 15:45:22",
	"client_ip": "182.108.169.91",
	"call_args": {
		"num_iid": "721785451149",
		"is_promotion": "1"
	},
	"api_type": "taobao",
	"translate_language": "zh-CN",
	"translate_engine": "baidu",
	"server_memory": "6.08MB",
	"request_id": "gw-1.64ae5a10806bc",
	"last_id": "1867272460"
}

你可能感兴趣的:(开发语言,json,python,API接口)