Encapsulate Shopee product list, shopee details, shopee comment data interface code display tutorial through interface

Business Background: As one of the largest B2C e-commerce platforms in the world, the Shopee platform provides a wealth of commodity resources and attracts a large number of global buyers and sellers. In order to facilitate developers to access the Shopee platform, the Shopee platform provides a wealth of API interfaces, of which the product details interface is a very important part. We have discussed the stable collection of the real-time product details data interface of the entire Shopee site (supporting multiple sites). Through this interface, developers can better understand the situation of the products and query the detailed information of the products. The data parameters include: get the main image of the product list, Price, title, sku, product review date, review content, review picture, buyer nickname, post-review content, product attributes, post-review attribute pictures, etc. The complete data solution on the page helps buyers to purchase products more accurately . This got me interested in technical challenges. At present, I have done a stress test myself. The QPS is high, the probability of a slider is extremely low, and the API is generally stable. The performance requirements of business scenarios such as store synchronization, CID store order return interface, etc., the encapsulation code tutorial is shown next:

1. Request method: HTTPS GET POST

2. Public parameters:

name type must describe
request address String yes https://o0b.cn/iiandy
key String yes Call key (must be spliced ​​in the URL in GET mode)
secret String yes Call key (copy v:taobaoapi2014)
api_name String yes API interface name (included in the request address) [item_search, item_get, item_search_shop, etc.]
cache String no [yes, no] The default is yes, the cached data will be called, and the speed is relatively fast
result_type String no [json,jsonu,xml,serialize,var_export] returns the data format, the default is json, and the content output by jsonu can be read directly in Chinese
lang String no [cn,en,ru] translation language, default cn Simplified Chinese
version String no API version

3. Request parameters (support taobao (tmall), JD, 1688, Pinduoduo, lazada, amazon, aliexpress and more than 30 well-known e-commerce platforms in the world, such as real-time commodity data of the whole site, and encapsulate the interface call data in the same way)

请求参数:num_iid=264070136/5637247041&country=.com.my

参数说明:num_iid:商品ID-country:网站后缀(.com.my;.vn;.ph)

4. Request code examples, support high concurrent requests (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://vx19970108018.cn/shopee/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=264070136/5637247041&country=.com.my"
headers = {
    "Accept-Encoding": "gzip",
    "Connection": "close"
}
if __name__ == "__main__":
    r = requests.get(url, headers=headers)
    json_obj = r.json()
    print(json_obj)

5. Due to the character limit of the article, the response example will not be displayed for the time being. Code exchanges are welcome.

おすすめ

転載: blog.csdn.net/Andyfu2019/article/details/129837629