要获取店铺详情,你需要使用1688API接口。以下是一个简单的Python示例,展示了如何使用requests库调用阿里巴巴API并解析返回的数据:
# 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://seller_info/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&sid=b2b-2206619673102e9470"
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
}
if __name__ == "__main__":
r = requests.get(url, headers=headers)
json_obj = r.json()
print(json_obj)
请注意,你需要先获取Api Key和Api Secret。此外,你还需要根据1688阿里巴巴文档生成签名(sign)。
这个示例仅用于演示目的,实际使用时请参考1688阿里巴巴API文档以获取更多详细信息和正确处理错误。
API接口请求响应示例
{
"user": {
"id": "37405963",
"nick": "深圳市多亲科技有限公司",
"good_num": "",
"level": "",
"created": "",
"shop_type": "",
"user_num_id": "b2b-2206619673102e9470",
"company_id": "",
"company_dj": "深圳市多亲科技有限公司",
"company_time": "",
"company_info": null,
"cid": "-1",
"sid": "b2b-2206619673102e9470",
"title": "深圳市多亲科技有限公司",
"address": "广东 深圳",
"zhuy": "https://m.1688.com/winport/b2b-2206619673102e9470.html",
"fh_score": "5.0",
"hm_score": "5.0",
"xy_score": "2.0",
"ht_score": "5.0",
"qe_score": "0.0",
"menu": "",
"tplogo": "//cbu01.alicdn.com/cms/upload/2016/790/696/2696097_1254399316.png",
"ratelogourl": "https://img.alicdn.com/imgextra/i2/O1CN01AUrNmz1Mb3n1wG6Z1_!!6000000001452-2-tps-48-48.png",
"tpyear": "4",
"star": "3.5",
"bsrdata": "",
"_ddf": "cdy"
},
"secache": "b4cb1839f4d75b3991d8e7ed9ab1f3e6",
"secache_time": 1695279142,
"secache_date": "2023-09-21 14:52:22",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"error": "",
"reason": "",
"error_code": "0000"