首页 > 编程语言 >如何用python对接电商平台店铺所有商品数据接口

如何用python对接电商平台店铺所有商品数据接口

时间:2023-01-04 13:31:09浏览次数:63  
标签:null python price 接口 seller item url 电商 id

前言

item_search_shop-获得店铺的所有商品接口,可以通过店铺ID或者是店铺主链接请求接口拿到店铺商品详情页面的商品标题,商品价格,商品优惠价,商品视频,商品图片,商品sku属性,商品sku属性描述,发货地,库存,商品销量,店铺优惠券,店铺促销信息等页面上有的数据均可以拿到,以上的数据可以用于行业数据分析,商品搬家业务,商品品牌维护,商品价格监控,商品销量监控,代购商城等业务场景均可以用上,接口代码对接如下:

1.请求参数(​​点击注册获取测试key和secret​​)

请求参数:shop_id=433655136&page=1&sort=  

参数说明: shop_id:shop_id page:页码

sort:排序[new,bid,sale]

 (new 新品,bid:价格,sale:销量,bid加_前缀为从大到小排序)

如何用python对接电商平台店铺所有商品数据接口_店铺商品列表接口

2.请求代码示例,支持高并发请求(CURL、PHP 、PHPsdk 、Java 、C# 、Python…)

# 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://wx19970108018/taobao/item_search_shop/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&shop_id=433655136&page=1&sort="
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
}
if __name__ == "__main__":
r = requests.get(url, headers=headers)
json_obj = r.json()
print(json_obj)

3.响应示例

Result Object:
---------------------------------------
{
"items": {
"shop_id": "433655136",
"page": "1",
"has_next_page": null,
"real_total_results": "90",
"total_results": "90",
"page_size": 10,
"page_count": 9,
"_ddf": "cdy",
"item": [
{
"num_iid": "694015753924",
"pic_url": "http://g.search2.alicdn.com/img/bao/uploaded/i4/i2/2209411885160/O1CN01iYMOPD1nzKVGDNLTq_!!2209411885160.jpg",
"title": "【低至4折专区】IFIK 2022折扣合集 不退不换",
"promotion_price": "110.00",
"price": "110.00",
"sales": 200,
"quantity": "976",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=694015753924"
},
{
"num_iid": "689564169103",
"pic_url": "http://g.search.alicdn.com/img/bao/uploaded/i4/i2/2209411885160/O1CN01z4A9qJ1nzKVLz54kg_!!2209411885160.jpg",
"title": "IFIK OS Denim Jacket实现秋日自由加厚灰色洗水帆布牛仔夹克棉服",
"promotion_price": "650.00",
"price": "650.00",
"sales": 100,
"quantity": "30",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=689564169103"
},
{
"num_iid": "693326171325",
"pic_url": "http://g.search.alicdn.com/img/bao/uploaded/i4/i2/2209411885160/O1CN01xf9UFw1nzKVKBaz0K_!!2209411885160.jpg",
"title": "IFIK Denim Top 优雅丹宁 复古茶色线一字肩修身鱼骨牛仔长袖上衣",
"promotion_price": "400.00",
"price": "400.00",
"sales": 200,
"quantity": "1533",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=693326171325"
},
{
"num_iid": "680980248643",
"pic_url": "http://g.search2.alicdn.com/img/bao/uploaded/i4/i3/2209411885160/O1CN01tRdLXu1nzKVGDP5TE_!!2209411885160.jpg",
"title": "IFIK Cargo Pants 程潇同款 经典13盎司日本原色廓形牛仔工装裤",
"promotion_price": "450.00",
"price": "450.00",
"sales": 100,
"quantity": "103",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=680980248643"
},
{
"num_iid": "683116004498",
"pic_url": "http://g.search1.alicdn.com/img/bao/uploaded/i4/i2/2209411885160/O1CN01IWuDPS1nzKVDCbWgN_!!2209411885160.jpg",
"title": "IFIK Rib Sweater 3D原创结构 建模织法罗纹针织圆领纯色长袖毛衣",
"promotion_price": "360.00",
"price": "360.00",
"sales": 1000,
"quantity": "2109",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=683116004498"
},
{
"num_iid": "679682849416",
"pic_url": "http://g.search2.alicdn.com/img/bao/uploaded/i4/i3/2209411885160/O1CN01GTG8oL1nzKVDCcb95_!!2209411885160.jpg",
"title": "IFIK Cargo Pants 吴宣仪同款 13盎司重工宽松阔腿牛仔工装裤",
"promotion_price": "480.00",
"price": "480.00",
"sales": 100,
"quantity": "162",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=679682849416"
},
{
"num_iid": "680932585969",
"pic_url": "http://g.search2.alicdn.com/img/bao/uploaded/i4/i3/2209411885160/O1CN01exh6oB1nzKV751Z0J_!!2209411885160.jpg",
"title": "IFIK CropKnit 赛博格 耳机链超短款牛仔渐变水貂半高领针织开衫",
"promotion_price": "490.00",
"price": "490.00",
"sales": 400,
"quantity": "315",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=680932585969"
},
{
"num_iid": "689357525769",
"pic_url": "http://g.search2.alicdn.com/img/bao/uploaded/i4/i3/2209411885160/O1CN01Z4yX9N1nzKVBqLG9K_!!2209411885160.jpg",
"title": "IFIK Bomber Jacket 做旧水洗粉红牛仔夹棉飞行夹克棉服",
"promotion_price": "750.00",
"price": "750.00",
"sales": 100,
"quantity": "69",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=689357525769"
},
{
"num_iid": "675006395148",
"pic_url": "http://g.search2.alicdn.com/img/bao/uploaded/i4/i4/2209411885160/O1CN01KtZ9Lw1nzKVDwQikb_!!2209411885160.jpg",
"title": "IFIK Leather Jacket 'Hunter复古水洗牛仔拼皮夹克 短款垫肩外套",
"promotion_price": "580.00",
"price": "580.00",
"sales": 95,
"quantity": "218",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=675006395148"
},
{
"num_iid": "674342109993",
"pic_url": "http://g.search2.alicdn.com/img/bao/uploaded/i4/i4/2209411885160/O1CN01ymH9hi1nzKVKtDE0M_!!2209411885160.jpg",
"title": "IFIK Bootcut Jeans #1969 50粒铆钉复古高腰微喇重洗水牛仔裤",
"promotion_price": "400.00",
"price": "400.00",
"sales": 400,
"quantity": "159",
"seller_nick": null,
"seller_id": null,
"shop_id": "433655136",
"detail_url": "https://item.taobao.com/item.htm?id=674342109993"
}
]
},
"error_code": "0000",
"reason": "ok",
"secache": "5177b6f4db5be7bfce9032529452fd88",
"secache_time": 1672809562,
"secache_date": "2023-01-04 13:19:22",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"error": "",
"cache": 0,
"api_info": "today:26 max:10000 all[118=26+65+27];expires:2030-12-31",
"execution_time": "0.714",
"server_time": "Beijing/2023-01-04 13:19:22",
"client_ip": "106.6.33.129",
"call_args": {
"seller_nick": "433655136",
"start_price": "1"
},
"api_type": "taobao",
"translate_language": "zh-CN",
"translate_engine": "baidu",
"server_memory": "5.99MB",
"request_id": "gw-1.63b50c5a36225",
"last_id": "1454293911"
}

标签:null,python,price,接口,seller,item,url,电商,id
From: https://blog.51cto.com/u_14655602/5988336

相关文章

  • 本地python环境安装kylin项目依赖时报认证错误信息
    问题描述:项目需要连接kylin数据库查询数据,本地安装kylin项目的依赖环境后报认证错误python版本3.732位pycharm版本2022版成功方法:更换解释器选择无解释器,创建虚......
  • python内置方法
    内置方法Python解释器内置了许多函数和类型,这些函数和类型始终可用。按照使用的频率做如下排序排序点击查看代码#----------------------------排序---------......
  • python图像与办公文档处理
    1.颜色。如果你有使用颜料画画的经历,那么一定知道混合红、黄、蓝三种颜料可以得到其他的颜色,事实上这三种颜色就是被我们称为美术三原色的东西,它们是不能再分解的基本颜......
  • python套接字
    fromsocketimportsocket,SOCK_STREAM,AF_INETfromdatetimeimportdatetimedefmain():#1.创建套接字对象并指定使用哪种传输服务#family=AF_INET......
  • 浅析 Dubbo 3.0 中接口级地址推送性能的优化
    URL简介在阐述地址推送性能的具体优化之前,我们有必要先了解一下与之息息相关的内容---URL。定义在不谈及dubbo时,我们大多数人对URL这个概念并不会感到陌生。统一......
  • python调用项目外py文件问题及解决方案
    问题来源:为了支持模型的切换功能,拟通过调用不同模型路径下的predict.py方法来实现。这就涉及到调用外部py文件。调用外部py文件,有多种方式:方法一:sys.path1impo......
  • 8款常用Python数据分析工具推荐!
    Python是世界上最简单的编程语言之一,简单易懂,可快速上手,因此也成为数据分析领域的首选语言。本篇文章为大家推荐8款常用Python数据分析工具,快来学习一下吧。1.Nump......
  • [python] TypeError: expected str, bytes or os.PathLike object, not NoneType
    参考链接:https://blog.csdn.net/weixin_42345113/article/details/104514545出现这个问题多半是没有指定路径,上述问题翻译过来是,期望一个字符串或者字节路径,而不是默认值,......
  • 浅析 Dubbo 3.0 中接口级地址推送性能的优化
    URL简介在阐述地址推送性能的具体优化之前,我们有必要先了解一下与之息息相关的内容---URL。定义在不谈及dubbo时,我们大多数人对URL这个概念并不会感到陌生。统一......
  • python中进程与线程
    frommultiprocessingimportProcessfromosimportgetpidfromrandomimportrandintfromtimeimporttime,sleep#实现数据共享方式管道.套接字共享内存区#......