【拼多多API 开发系列】百亿补贴商品详情接口,代码封装

news/2024/12/28 11:45:48/

为了进行电商平台 PDD 的API开发,首先我们需要做下面几件事情。
1)开发者注册一个账号
2)然后为每个 PDD 应用注册一个应用程序键(App Key) 。
3)下载 PDD API的SDK并掌握基本的API基础知识和调用
4)利用SDK接口和对象,传入AppKey或者必要的时候获取并传入SessionKey来进行程序开发。
5)利用PDD平台的文档中心和API测试工具,对接口进行测试。从而了解返回信息,方便程序获取。
以上是一般 PDD API应用开发的关键流程,其中通过 PDD文档中心和API测试工具,进行概念了解和接口信息查询很重要。因为这些数据就是我们需要在逐步显示出来的。 PDD 的API很多,不过都分为了好几个领域,慢慢就会了解深入了。

 item_get-根据ID取商品详情接口
通过代码封装该接口可以拿到商品标题,商品价格,商品促销信息,商品优惠价,商品库存,sku属性,商品图片,desc图片,desc描述,sku图片,sku描述,商品规格,商品销量,商品重量,商品尺寸,商品列表,店铺所有商品,商品详情属性描述等页面上有的参数均可以拿到。

请求方式:HTTPS GET POST 

Pinduoduo.item_get

公共参数

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

请求参数

请求参数:num_iid=1620002566参数说明:num_iid:商品ID ;

请求示例

# 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/pinduoduo/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=1620002566"
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": 1620002566,"title": "【2件套】套装秋冬新款仿獭兔毛钉珠皮草毛毛短外套加厚大衣女装","price": 95.4,"minGroupPrice": 95.4,"maxGroupPrice": 95.4,"total_price": "","desc_short": "【2件套】套装秋冬新款仿獭兔毛钉珠皮草毛毛短外套加厚大衣女装","cid": 8484,"orginal_price": 1.15,"nick": "果果家气质女装","num": 1000,"sales": 43000,"detail_url": "https://mobile.yangkeduo.com/goods1.html?goods_id=1620002566","desc": "<img src=\"https://img.pddpic.com/mms-material-img/2022-09-18/3f89d470-1af8-4dee-b529-6d62aa2ea3b7.png\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2019-02-15/ddf6fe7b-b536-4183-932d-69a1189a3f59.png\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/20f659b04d3e7e5851c27ff9931c96fc.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2019-11-14/4420a8c3-49ed-46d8-ab55-15e7a638ca31.jpg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/26c3e9d5cfbaf4e8f13b2bdd38f48d71.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/0aa872fa74599dad7b6aefe6b6c035c0.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/6bc959e32a30424c7a5284a37676999c.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/1fa9861a8c99c5e9e8119fd2239fef5a.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/b62cabf1d2320c5761e3f4c15203fb20.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/6f6e54376a66cbc78e16700d4c424fe1.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/2f60753dfc875a6876adc35833a69d31.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/ae0116e589d8de712f8dafd0c356cefe.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/da910c98fcc8de1b4d2d1498cd7899fd.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/140349649d8b7d08c8e88bfbbaa2f900.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/a953bae2eeb7364ef3ef2976a97d07eb.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/4da59828136c3b1308aad0aa990778a7.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-09-02/4a365b61a80e47288c8609ccd5982396.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-11-17/cd0a8a96b783a51236812ce24c59a329.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-11-17/16008ac19768d05e7dee16406ff958a1.jpeg\"/><img src=\"https://t00img.yangkeduo.com/goods/images/2018-11-17/ef1d17b69ebf9449a8bb52459b168c26.jpeg\"/><img src=\"https://www.o0b.cn/i.php?t.png&rid=gw-1.646ec33f17ec3&p=1778788018&k=i_key&t=1684980549\" style=\"display:none\" />","item_imgs": [{"url": "https://omsproductionimg.yangkeduo.com/images/2017-12-12/bcf848aa71c6389607ae7a84b70f1543.jpeg"},{"url": "https://omsproductionimg.yangkeduo.com/images/2017-12-12/176019babfdecffa1d9f98f40b7e99b4.jpeg"},{"url": "https://omsproductionimg.yangkeduo.com/images/2017-12-12/efb5db42397550bffd3211ca6f197498.jpeg"},{"url": "https://omsproductionimg.yangkeduo.com/images/2017-12-12/d209ef7bcc9183c3bb8ca1dfdb108d49.jpeg"},{"url": "https://omsproductionimg.yangkeduo.com/images/2017-12-12/74257ab65f3f00da7a90fde9042fe640.jpeg"},{"url": "https://img.pddpic.com/goods/images/2019-08-17/e8fbd9cb-cc74-4caa-9380-84c46d27b008.jpg"},{"url": "https://img.pddpic.com/goods/images/2019-08-17/d76f515b-e375-4060-b94e-cf64f6b0964e.jpg"},{"url": "https://img.pddpic.com/goods/images/2019-08-17/f2f279b5-6000-4fbe-b99b-7c1cbd7884ea.jpg"}],"pic_url": "https://omsproductionimg.yangkeduo.com/images/2018-06-06/463c0e2a5580ba3266846e41fe3e444a.jpeg","props_name": "1215:1115500378:颜色:粉色两件套(外套+裙子);1215:1115501666:颜色:米色两件套(外套+裙子);1215:105309781:颜色:蓝色两件套(外套+裙子);1226:119128:尺码:S(90斤以下);1226:96784:尺码:M(90-100斤);1226:33651:尺码:L(100-110斤);1226:33652:尺码:XL(110-120斤);1226:33653:尺码:2XL(120-130斤);1226:33656:尺码:3XL(130-140斤);","prop_imgs": {"prop_img": [{"properties": "1215:1115500378","url": "https://t00img.yangkeduo.com/goods/images/2018-08-28/062d42b525a7c786920cbb83ac772af7.jpeg"},{"properties": "1215:1115501666","url": "https://t00img.yangkeduo.com/goods/images/2018-08-28/415bed99d5a925123d7b7c39547205de.jpeg"},{"properties": "1215:105309781","url": "https://t00img.yangkeduo.com/goods/images/2018-11-17/48b30664f0f7e526ab1b956e813f25cf.jpeg"}]},"props": [{"name": "面料材质","value": "仿皮草"},{"name": "成分含量","value": "71%(含)—80%(含)"},{"name": "版型","value": "修身"},{"name": "领型","value": "圆领"},{"name": "衣长","value": "短款"},{"name": "是否带毛领","value": "不带毛领"},{"name": "主风格","value": "气质名媛"}],"skus": {"sku": [{"price": 95.4,"orginal_price": 115,"properties": "1215:1115500378;1226:119128","properties_name": "1215:1115500378:颜色:粉色两件套(外套+裙子);1226:119128:尺码:S(90斤以下)","quantity": 108,"sku_id": 57114357891},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115500378;1226:96784","properties_name": "1215:1115500378:颜色:粉色两件套(外套+裙子);1226:96784:尺码:M(90-100斤)","quantity": 38,"sku_id": 57114357892},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115500378;1226:33651","properties_name": "1215:1115500378:颜色:粉色两件套(外套+裙子);1226:33651:尺码:L(100-110斤)","quantity": 59,"sku_id": 57114357893},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115500378;1226:33652","properties_name": "1215:1115500378:颜色:粉色两件套(外套+裙子);1226:33652:尺码:XL(110-120斤)","quantity": 114,"sku_id": 57114357894},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115500378;1226:33653","properties_name": "1215:1115500378:颜色:粉色两件套(外套+裙子);1226:33653:尺码:2XL(120-130斤)","quantity": 200,"sku_id": 57114357895},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115500378;1226:33656","properties_name": "1215:1115500378:颜色:粉色两件套(外套+裙子);1226:33656:尺码:3XL(130-140斤)","quantity": 126,"sku_id": 57114357896},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115501666;1226:119128","properties_name": "1215:1115501666:颜色:米色两件套(外套+裙子);1226:119128:尺码:S(90斤以下)","quantity": 962,"sku_id": 57114357897},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115501666;1226:96784","properties_name": "1215:1115501666:颜色:米色两件套(外套+裙子);1226:96784:尺码:M(90-100斤)","quantity": 135,"sku_id": 57114357898},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115501666;1226:33651","properties_name": "1215:1115501666:颜色:米色两件套(外套+裙子);1226:33651:尺码:L(100-110斤)","quantity": 135,"sku_id": 57114357899},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115501666;1226:33652","properties_name": "1215:1115501666:颜色:米色两件套(外套+裙子);1226:33652:尺码:XL(110-120斤)","quantity": 578,"sku_id": 57114357900},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115501666;1226:33653","properties_name": "1215:1115501666:颜色:米色两件套(外套+裙子);1226:33653:尺码:2XL(120-130斤)","quantity": 124,"sku_id": 57114357901},{"price": 95.4,"orginal_price": 115,"properties": "1215:1115501666;1226:33656","properties_name": "1215:1115501666:颜色:米色两件套(外套+裙子);1226:33656:尺码:3XL(130-140斤)","quantity": 249,"sku_id": 57114357902},{"price": 95.4,"orginal_price": 115,"properties": "1215:105309781;1226:119128","properties_name": "1215:105309781:颜色:蓝色两件套(外套+裙子);1226:119128:尺码:S(90斤以下)","quantity": 556,"sku_id": 103851107855},{"price": 95.4,"orginal_price": 115,"properties": "1215:105309781;1226:96784","properties_name": "1215:105309781:颜色:蓝色两件套(外套+裙子);1226:96784:尺码:M(90-100斤)","quantity": 515,"sku_id": 103851107856},{"price": 95.4,"orginal_price": 115,"properties": "1215:105309781;1226:33651","properties_name": "1215:105309781:颜色:蓝色两件套(外套+裙子);1226:33651:尺码:L(100-110斤)","quantity": 843,"sku_id": 103851107857},{"price": 95.4,"orginal_price": 115,"properties": "1215:105309781;1226:33652","properties_name": "1215:105309781:颜色:蓝色两件套(外套+裙子);1226:33652:尺码:XL(110-120斤)","quantity": 546,"sku_id": 103851107858},{"price": 95.4,"orginal_price": 115,"properties": "1215:105309781;1226:33653","properties_name": "1215:105309781:颜色:蓝色两件套(外套+裙子);1226:33653:尺码:2XL(120-130斤)","quantity": 561,"sku_id": 103851107853},{"price": 95.4,"orginal_price": 115,"properties": "1215:105309781;1226:33656","properties_name": "1215:105309781:颜色:蓝色两件套(外套+裙子);1226:33656:尺码:3XL(130-140斤)","quantity": 570,"sku_id": 103851107854}]},"props_list": {"1215:1115500378": "颜色:粉色两件套(外套+裙子)","1215:1115501666": "颜色:米色两件套(外套+裙子)","1215:105309781": "颜色:蓝色两件套(外套+裙子)","1226:119128": "尺码:S(90斤以下)","1226:96784": "尺码:M(90-100斤)","1226:33651": "尺码:L(100-110斤)","1226:33652": "尺码:XL(110-120斤)","1226:33653": "尺码:2XL(120-130斤)","1226:33656": "尺码:3XL(130-140斤)"},"props_img": {"1215:1115500378": "https://t00img.yangkeduo.com/goods/images/2018-08-28/062d42b525a7c786920cbb83ac772af7.jpeg","1215:1115501666": "https://t00img.yangkeduo.com/goods/images/2018-08-28/415bed99d5a925123d7b7c39547205de.jpeg","1215:105309781": "https://t00img.yangkeduo.com/goods/images/2018-11-17/48b30664f0f7e526ab1b956e813f25cf.jpeg"},"property_alias": "","_ddf": "xdl","shop_id": 461742,"seller_info": {"nick": "果果家气质女装","score": 4.41,"delivery_score": 4.41,"item_score": null,"shop_type": "","user_num_id": 461742,"shop_name": "果果家气质女装","zhuy": "https://mobile.yangkeduo.com/mall_page.html?mall_id=461742","sid": 461742},"format_check": "ok","desc_img": ["https://img.pddpic.com/mms-material-img/2022-09-18/3f89d470-1af8-4dee-b529-6d62aa2ea3b7.png","https://t00img.yangkeduo.com/goods/images/2019-02-15/ddf6fe7b-b536-4183-932d-69a1189a3f59.png","https://t00img.yangkeduo.com/goods/images/2018-09-02/20f659b04d3e7e5851c27ff9931c96fc.jpeg","https://t00img.yangkeduo.com/goods/images/2019-11-14/4420a8c3-49ed-46d8-ab55-15e7a638ca31.jpg","https://t00img.yangkeduo.com/goods/images/2018-09-02/26c3e9d5cfbaf4e8f13b2bdd38f48d71.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/0aa872fa74599dad7b6aefe6b6c035c0.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/6bc959e32a30424c7a5284a37676999c.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/1fa9861a8c99c5e9e8119fd2239fef5a.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/b62cabf1d2320c5761e3f4c15203fb20.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/6f6e54376a66cbc78e16700d4c424fe1.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/2f60753dfc875a6876adc35833a69d31.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/ae0116e589d8de712f8dafd0c356cefe.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/da910c98fcc8de1b4d2d1498cd7899fd.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/140349649d8b7d08c8e88bfbbaa2f900.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/a953bae2eeb7364ef3ef2976a97d07eb.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/4da59828136c3b1308aad0aa990778a7.jpeg","https://t00img.yangkeduo.com/goods/images/2018-09-02/4a365b61a80e47288c8609ccd5982396.jpeg","https://t00img.yangkeduo.com/goods/images/2018-11-17/cd0a8a96b783a51236812ce24c59a329.jpeg","https://t00img.yangkeduo.com/goods/images/2018-11-17/16008ac19768d05e7dee16406ff958a1.jpeg","https://t00img.yangkeduo.com/goods/images/2018-11-17/ef1d17b69ebf9449a8bb52459b168c26.jpeg"],"shop_item": [],"relate_items": []},"error": "","secache": "38dc3c822554ca397f00e5e9b681e8fb","secache_time": 1684980549,"secache_date": "2023-05-25 10:09:09","translate_status": "","translate_time": 0,"language": {"default_lang": "cn","current_lang": "cn"},"reason": "","error_code": "0000","cache": 0,"api_info": "today:166 max:10100 all[312=166+75+71];expires:2030-12-31","execution_time": "6.317","server_time": "Beijing/2023-05-25 10:09:09","client_ip": "106.6.38.178","call_args": {"num_iid": "1620002566"},"api_type": "pinduoduo","translate_language": "zh-CN","translate_engine": "baidu","server_memory": "3.33MB","request_id": "gw-1.646ec33f17ec3","last_id": "1761916503"
}


http://www.ppmy.cn/news/84024.html

相关文章

线程的状态,多线程带来的风险,synchronized关键字及死锁问题

目录 状态 线程的意义 多线程带来的风险——线程安全✅ 线程安全的概念 线程不安全的原因 抢占式执行&#xff0c;随机性调度 修改共享数据 原子性->加&#x1f512; 可见性 指令重排序 解决线程不安全问题&#xff08;学完线程再总结&#xff09; synchronized关键字——监…

TPlinker解读

参考&#xff1a; 关系抽取之TPLinker解读加源码分析 TPLinker 实体关系抽取代码解读 实体关系联合抽取&#xff1a;TPlinker TPLinker中文注释版 Tagging TPLinker模型需要对关系三元组(subject, relation, object)进行手动Tagging&#xff0c;过程分为三部分&#xff1a; &…

用工业显微镜来观察生物细胞

尝试用工业显微镜来观察生物细胞&#xff0c;成像质量不是很好&#xff0c;但感觉还是能看一下。专业生物用显微镜真的太贵了。 软件&#xff1a;JCameraPro可以在这下载&#xff1a;www.jfirmware.com 摄像机&#xff1a;OPLENIC Cam的某个OEM版。 OPLENIC Cam很多OEM版&am…

详解Python的Flash框架的常用语句 app = Flask(__name__),为什要以全局变量__name__作为初始化参数?

详解Python的Flash框架的常用语句&#xff1a; app Flask(__name__)这一语句创建了一个Flask应用程序对象。 Flask是一个基于Python的轻量级Web框架&#xff0c;用于构建Web应用程序。在使用Flask时&#xff0c;我们需要创建一个Flask应用程序对象&#xff0c;该对象将充当我…

华为OD机试之字符串重新排列、字符串重新排序(Java源码)

字符串重新排列、字符串重新排序 题目描述 给定一个字符串s&#xff0c;s包括以空格分隔的若干个单词&#xff0c;请对s进行如下处理后输出&#xff1a; 1、单词内部调整&#xff1a;对每个单词字母重新按字典序排序 2、单词间顺序调整&#xff1a; 1&#xff09;统计每个单词…

sa:segment anything Demo学习与介绍

地址 论文地址:https://arxiv.org/pdf/2304.02643v1.pdf 代码:https://github.com/facebookresearch/segment-anything 贡献 1、对未知的数据集和任务具有良好的零样本(zero-shot)分割性能。分割过程可全自动分割(Everything模式)或由不同的手工提示(Prompt模式)驱动…

gcc编译器报错集锦

文章主要记录一下不常见的错误&#xff0c;供后续开发参考&#xff1a; 日期&#xff1a;2023-05-25 16:31:41 报错&#xff1a;cc1: all warnings being treated as errors 编译条件&#xff1a; Ubuntu 18.04&#xff0c;编译器&#xff1a;aarch64-mix210-linux-gcc编译代码…

2023-04-23 学习记录--C/C++-邂逅C/C++(中)

合抱之木&#xff0c;生于毫末&#xff1b;九层之台&#xff0c;起于累土&#xff1b;千里之行&#xff0c;始于足下。&#x1f4aa;&#x1f3fb; 上一篇&#xff1a;邂逅C/C&#xff08;上&#xff09; 一、if语句 ⭐️ &#xff08;一&#xff09;、格式 &#x1f36d; if…