├── ddk ├── api │ ├── rest │ │ ├── __init__.py │ │ ├── DdkOrderDetailGet.py │ │ ├── DdkThemeGoodsSearch.py │ │ ├── DdkGoodsPidQuery.py │ │ ├── DdkGoodsPidGenerate.py │ │ ├── DdkThemeListGet.py │ │ ├── GoodsCatsGet.py │ │ ├── DdkMallGoodsListGet.py │ │ ├── DdkGoodsZsUnitUrlGen.py │ │ ├── DdkWeappQrcodeUrlGen.py │ │ ├── DdkRpPromUrlGenerate.py │ │ ├── DdkLotteryUrlGen.py │ │ ├── DdkMallUrlGen.py │ │ ├── DdkMerchantListGet.py │ │ ├── DdkGoodsDetail.py │ │ ├── DdkThemePromUrlGenerate.py │ │ ├── DdkOrderListIncrementGet.py │ │ ├── DdkGoodsPromotionUrlGenerate.py │ │ └── DdkGoodsSearch.py │ ├── __init__.py │ └── base.py └── __init__.py ├── setup.py ├── 测试 ├── demo.py ├── 多多客查店铺列表接口1.py ├── 多多客生成单品推广小程序二维码url1.py ├── 根据商品ID查询相关商品-商品推荐1.py ├── 多多客工具生成转盘抽免单url1.py ├── 创建多多进宝推广位1.py ├── 查询已经生成的推广位信息1.py ├── 多多客工具生成店铺推广链接API1.py ├── 查询订单详情1.py ├── 多多进宝转链接口1.py ├── 同步推广订单列表1.py ├── 商品关键词搜索1.py ├── 多多进宝主题活动推广链接生成1.py ├── 多多进宝主题列表查询1.py ├── 生成红包推广链接1.py ├── 获取商品信息1.py ├── 生成普通商品推广链接1.py ├── 获取拼多多标准商品类目信息1.py ├── 下线 │ └── 查询店铺商品1.py └── 多多进宝主题商品查询1.py ├── .gitignore ├── README.md └── LICENSE /ddk/api/rest/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 11:52 3 | # @Author : play4fun 4 | # @File : __init__.py.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | __init__.py.py: 9 | """ 10 | 11 | -------------------------------------------------------------------------------- /ddk/api/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 11:50 3 | # @Author : play4fun 4 | # @File : __init__.py.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | __init__.py.py: 9 | """ 10 | 11 | from ddk.api.rest import * 12 | from ddk.api.base import FileItem -------------------------------------------------------------------------------- /ddk/api/rest/DdkOrderDetailGet.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-10 15:12 3 | # @Author : play4fun 4 | # @File : DdkOrderDetailGet.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkOrderDetailGet.py: 9 | 查询订单详情 10 | 11 | """ 12 | 13 | from ddk.api.base import RestApi 14 | 15 | 16 | class DdkOrderDetailGet(RestApi): 17 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 18 | RestApi.__init__(self, domain, port) 19 | self.order_sn = None # 订单号 20 | 21 | def getapiname(self): 22 | return 'pdd.ddk.order.detail.get' 23 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkThemeGoodsSearch.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 17:09 3 | # @Author : play4fun 4 | # @File : DdkThemeGoodsSearch.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkThemeGoodsSearch.py: 9 | """ 10 | 11 | from ddk.api.base import RestApi 12 | 13 | 14 | class DdkThemeGoodsSearch(RestApi): 15 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 16 | RestApi.__init__(self, domain, port) 17 | # 18 | self.theme_id = None # 主题ID 19 | 20 | def getapiname(self): 21 | return 'pdd.ddk.theme.goods.search' 22 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkGoodsPidQuery.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 14:47 3 | # @Author : play4fun 4 | # @File : DdkGoodsPidQuery.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkGoodsPidQuery.py: 9 | 查询已经生成的推广位信息 10 | """ 11 | 12 | from ddk.api.base import RestApi 13 | 14 | 15 | class DdkGoodsPidQuery(RestApi): 16 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 17 | RestApi.__init__(self, domain, port) 18 | self.page_size = None # 返回的每页推广位数量 19 | self.page = None # 20 | 21 | def getapiname(self): 22 | return 'pdd.ddk.goods.pid.query' 23 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkGoodsPidGenerate.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-10 15:27 3 | # @Author : play4fun 4 | # @File : DdkGoodsPidGenerate.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkGoodsPidGenerate.py: 9 | 10 | 创建多多进宝推广位 11 | """ 12 | 13 | from ddk.api.base import RestApi 14 | 15 | 16 | class DdkGoodsPidGenerate(RestApi): 17 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 18 | RestApi.__init__(self, domain, port) 19 | self.number = None # 要生成的推广位数量,默认为10,范围为:1~100 20 | self.p_id_name_list = None # 推广位名称,例如["1","2"] 21 | 22 | def getapiname(self): 23 | return 'pdd.ddk.goods.pid.generate' 24 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkThemeListGet.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 17:05 3 | # @Author : play4fun 4 | # @File : DdkThemeListGet.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkThemeListGet.py: 9 | http://open.pinduoduo.com/#/apidocument/port?id=179 10 | 11 | 查询多多进宝主题列表 12 | """ 13 | 14 | from ddk.api.base import RestApi 15 | 16 | 17 | class DdkThemeListGet(RestApi): 18 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 19 | RestApi.__init__(self, domain, port) 20 | # 21 | self.page_size = None # 22 | self.page = None # 23 | 24 | def getapiname(self): 25 | return 'pdd.ddk.theme.list.get' 26 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 11:42 3 | # @Author : play4fun 4 | # @File : setup.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | setup.py: 9 | """ 10 | 11 | 12 | from setuptools import setup, find_packages 13 | # print('find_packages:',find_packages()) 14 | 15 | setup( 16 | name='ddk', 17 | version='19.1.14.18', # 按日期 18 | author='play4fun', 19 | author_email='play4fun@foxmail.com', 20 | packages=find_packages(), 21 | install_requires=[], 22 | license='MIT', 23 | description="拼多多-多多客联盟 CPS 工具包", 24 | long_description_content_type="text/markdown", 25 | long_description='拼多多-多多客联盟 sdk,进行导购推广,有了它,不需要去写爬虫抓取联盟商品信息' 26 | ) 27 | -------------------------------------------------------------------------------- /ddk/api/rest/GoodsCatsGet.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 16:03 3 | # @Author : play4fun 4 | # @File : GoodsCatsGet.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | GoodsCatsGet.py: 9 | http://open.pinduoduo.com/#/apidocument/port?id=17 10 | 11 | 获取拼多多标准商品类目信息(请使用pdd.goods.authorization.cats接口获取商家可发布类目) 12 | """ 13 | 14 | from ddk.api.base import RestApi 15 | 16 | 17 | class GoodsCatsGet(RestApi): 18 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 19 | RestApi.__init__(self, domain, port) 20 | # 21 | self.parent_cat_id = None # 值=0时为顶点cat_id,通过树顶级节点获取cat树 22 | 23 | def getapiname(self): 24 | return 'pdd.goods.cats.get' 25 | -------------------------------------------------------------------------------- /ddk/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 11:47 3 | # @Author : play4fun 4 | # @File : __init__.py.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | __init__.py.py: 9 | """ 10 | 11 | __version__ = '19.1.14.18' 12 | __author__ = 'play4fun ' 13 | 14 | from ddk.api.base import sign 15 | 16 | 17 | class appinfo(object): 18 | def __init__(self, appkey, secret): 19 | self.appkey = appkey 20 | self.secret = secret 21 | 22 | 23 | def getDefaultAppInfo(): 24 | pass 25 | 26 | 27 | def setDefaultAppInfo(appkey, secret): 28 | default = appinfo(appkey, secret) 29 | global getDefaultAppInfo 30 | getDefaultAppInfo = lambda: default 31 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkMallGoodsListGet.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 16:54 3 | # @Author : play4fun 4 | # @File : DdkMallGoodsListGet.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkMallGoodsListGet.py: 9 | http://open.pinduoduo.com/#/apidocument/port?id=179 10 | 11 | 查询店铺商品 12 | """ 13 | 14 | from ddk.api.base import RestApi 15 | 16 | 17 | class DdkMallGoodsListGet(RestApi): 18 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 19 | RestApi.__init__(self, domain, port) 20 | self.mall_id = None # 店铺id 21 | self.page_number = None # 分页数 22 | self.page_size = None # 返回的每页推广位数量 23 | 24 | def getapiname(self): 25 | return 'pdd.ddk.mall.goods.list.get' 26 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkGoodsZsUnitUrlGen.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-14 17:36 3 | # @Author : play4fun 4 | # @File : DdkGoodsZsUnitUrlGen.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkGoodsZsUnitUrlGen.py: 9 | http://open.pinduoduo.com/#/apidocument/port?id=106 10 | 多多进宝转链接口 11 | 12 | 本功能适用于采集群等场景。将其他推广者的推广链接转换成自己的; 13 | 通过此api,可以将他人的招商推广链接,转换成自己的招商推广链接 14 | """ 15 | 16 | from ddk.api.base import RestApi 17 | 18 | 19 | class DdkGoodsZsUnitUrlGen(RestApi): 20 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 21 | RestApi.__init__(self, domain, port) 22 | self.source_url = None # 需转链的链接 23 | self.pid: int = None # 推广位id 24 | 25 | def getapiname(self): 26 | return 'pdd.ddk.goods.zs.unit.url.gen' 27 | -------------------------------------------------------------------------------- /测试/demo.py: -------------------------------------------------------------------------------- 1 | 2 | from ddk.api.rest.DdkGoodsDetail import DdkGoodsDetail 3 | from ddk import appinfo 4 | import traceback,json 5 | from config import pdd_client_id,pdd_client_secret,pid 6 | 7 | def test1(): 8 | req = DdkGoodsDetail() 9 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 10 | # 11 | # goods_id='4532814226,2478116379'#参数错误:只支持单个goodsId查询 12 | goods_id='2478116379' 13 | req.goods_id_list = f'[{goods_id}]'# 14 | try: 15 | resp = req.getResponse() 16 | print(resp) 17 | print('-' * 40) 18 | print(json.dumps(resp)) 19 | 20 | # print(json.dumps(f, ensure_ascii=False)) 21 | except Exception as e: 22 | print(e) 23 | print(traceback.format_exc()) 24 | 25 | 26 | if __name__ == '__main__': 27 | test1() -------------------------------------------------------------------------------- /ddk/api/rest/DdkWeappQrcodeUrlGen.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-14 17:55 3 | # @Author : play4fun 4 | # @File : DdkWeappQrcodeUrlGen.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkWeappQrcodeUrlGen.py: 9 | 10 | http://open.pinduoduo.com/#/apidocument/port?id=106 11 | 多多客生成单品推广小程序二维码url 12 | """ 13 | 14 | 15 | from ddk.api.base import RestApi 16 | 17 | 18 | class DdkWeappQrcodeUrlGen(RestApi): 19 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 20 | RestApi.__init__(self, domain, port) 21 | self.p_id = None # 推广位id 22 | self.goods_id_list = None # 商品ID,仅支持单个查询 23 | self.custom_parameters = None # 自定义参数 24 | self.zs_duo_id = None # 招商多多客ID 25 | 26 | def getapiname(self): 27 | return 'pdd.ddk.weapp.qrcode.url.gen' 28 | -------------------------------------------------------------------------------- /测试/多多客查店铺列表接口1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 16:16 3 | # @Author : play4fun 4 | # @File : 多多客查店铺列表接口1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 多多客查店铺列表接口1.py: 9 | pdd.ddk.merchant.list.get 10 | 11 | DdkMerchantListGet 12 | """ 13 | 14 | from ddk.api.rest.DdkMerchantListGet import DdkMerchantListGet 15 | from ddk import appinfo 16 | import traceback, json 17 | from config import pdd_client_id, pdd_client_secret 18 | 19 | 20 | def test1(): 21 | req = DdkMerchantListGet() 22 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 23 | # 24 | req.mall_id_list = [1590059,327071922] 25 | try: 26 | resp = req.getResponse() 27 | print(resp) 28 | print('-' * 40) 29 | print(json.dumps(resp)) 30 | 31 | # print(json.dumps(f, ensure_ascii=False)) 32 | except Exception as e: 33 | print(e) 34 | print(traceback.format_exc()) 35 | 36 | 37 | if __name__ == '__main__': 38 | test1() 39 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkRpPromUrlGenerate.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-10 15:40 3 | # @Author : play4fun 4 | # @File : DdkRpPromUrlGenerate.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkRpPromUrlGenerate.py: 9 | 生成红包推广链接 10 | """ 11 | 12 | from ddk.api.base import RestApi 13 | 14 | 15 | class DdkRpPromUrlGenerate(RestApi): 16 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 17 | RestApi.__init__(self, domain, port) 18 | self.generate_short_url = None # 是否生成短链接,true-是,false-否 19 | self.p_id_list = None # 推广位列表,例如:["60005_612"] 20 | self.custom_parameters = None # 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。 21 | self.generate_weapp_webview = None # 是否生成唤起微信客户端链接,true-是,false-否,默认false 22 | self.we_app_web_view_short_url = None # 唤起微信app推广短链接 23 | self.we_app_web_wiew_url = None # 唤起微信app推广链接 24 | self.generate_we_app: bool = None # 是否生成小程序推广 25 | 26 | def getapiname(self): 27 | return 'pdd.ddk.rp.prom.url.generate' 28 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkLotteryUrlGen.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 14:42 3 | # @Author : play4fun 4 | # @File : DdkLotteryUrlGen.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkLotteryUrlGen.py: 9 | http://open.pinduoduo.com/#/apidocument/port?id=106 10 | 11 | 多多客生成转盘抽免单url 12 | """ 13 | 14 | from ddk.api.base import RestApi 15 | 16 | 17 | class DdkLotteryUrlGen(RestApi): 18 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 19 | RestApi.__init__(self, domain, port) 20 | # 21 | self.pid_list = None # 推广位列表,例如:["60005_612"] 22 | self.generate_weapp_webview = None # 是否生成唤起微信客户端链接,true-是,false-否,默认false 23 | self.generate_short_url = None # 是否生成短链接,true-是,false-否 24 | self.multi_group = None # true--生成多人团推广链接 false--生成单人团推广链接(默认false)1、单人团推广链接:用户访问单人团推广链接,可直接购买商品无需拼团。2、多人团推广链接:用户访问双人团推广链接开团,若用户分享给他人参团,则开团者和参团者的佣金均结算给推手 25 | self.custom_parameters = None # 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。 26 | 27 | def getapiname(self): 28 | return 'pdd.ddk.lottery.url.gen' 29 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkMallUrlGen.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 16:34 3 | # @Author : play4fun 4 | # @File : DdkMallUrlGen.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkMallUrlGen.py: 9 | http://open.pinduoduo.com/#/apidocument/port?id=179 10 | 11 | 多多客工具生成店铺推广链接API 12 | """ 13 | 14 | from ddk.api.base import RestApi 15 | 16 | 17 | class DdkMallUrlGen(RestApi): 18 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 19 | RestApi.__init__(self, domain, port) 20 | # 21 | self.mall_id = None # 店铺id 22 | self.pid = None # 推广位 23 | self.generate_weapp_webview = None # 是否生成唤起微信客户端链接,true-是,false-否,默认false 24 | self.generate_short_url = None # 是否生成短链接,true-是,false-否 25 | self.multi_group = None # true--生成多人团推广链接 false--生成单人团推广链接(默认false)1、单人团推广链接:用户访问单人团推广链接,可直接购买商品无需拼团。2、多人团推广链接:用户访问双人团推广链接开团,若用户分享给他人参团,则开团者和参团者的佣金均结算给推手 26 | self.custom_parameters = None # 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。 27 | 28 | def getapiname(self): 29 | return 'pdd.ddk.mall.url.gen' 30 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkMerchantListGet.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 16:17 3 | # @Author : play4fun 4 | # @File : DdkMerchantListGet.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkMerchantListGet.py: 9 | http://open.pinduoduo.com/#/apidocument/port?id=179 10 | 11 | 多多客查店铺列表接口 12 | """ 13 | 14 | from ddk.api.base import RestApi 15 | 16 | 17 | class DdkMerchantListGet(RestApi): 18 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 19 | RestApi.__init__(self, domain, port) 20 | # 21 | self.mall_id_list = None # 店铺id 22 | self.merchant_type_list = None # 店铺类型 23 | self.query_range_str = None # 查询范围0----商品拼团价格区间;1----商品券后价价格区间;2----佣金比例区间;3----优惠券金额区间;4----加入多多进宝时间区间;5----销量区间;6----佣金金额区间 24 | self.cat_id = None # 商品类目ID,使用pdd.goods.cats.get接口获取 25 | self.has_coupon = None # 是否有优惠券 (0 所有;1 必须有券。) 26 | self.page_number = None # 分页数 27 | self.page_size = None # 每页数量 28 | self.range_vo_list = None # 筛选范围 29 | 30 | def getapiname(self): 31 | return 'pdd.ddk.merchant.list.get' 32 | -------------------------------------------------------------------------------- /测试/多多客生成单品推广小程序二维码url1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-14 17:57 3 | # @Author : play4fun 4 | # @File : 多多客生成单品推广小程序二维码url1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 多多客生成单品推广小程序二维码url1.py: 9 | 10 | 没有权限! 11 | 12 | 其实也没用 13 | """ 14 | 15 | 16 | from ddk.api.rest.DdkWeappQrcodeUrlGen import DdkWeappQrcodeUrlGen 17 | from ddk import appinfo 18 | import traceback,json 19 | from config import pdd_client_id,pdd_client_secret,pid 20 | 21 | def test1(): 22 | req = DdkWeappQrcodeUrlGen() 23 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 24 | # goods_id='4532814226,2478116379'#参数错误:只支持单个goodsId查询 25 | goods_id='2478116379' 26 | req.goods_id_list = f'[{goods_id}]'# 27 | req.p_id = pid 28 | 29 | try: 30 | resp = req.getResponse() 31 | print(resp) 32 | print('-' * 40) 33 | print(json.dumps(resp)) 34 | 35 | # print(json.dumps(f, ensure_ascii=False)) 36 | except Exception as e: 37 | print(e) 38 | print(traceback.format_exc()) 39 | 40 | 41 | if __name__ == '__main__': 42 | test1() -------------------------------------------------------------------------------- /ddk/api/rest/DdkGoodsDetail.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 12:55 3 | # @Author : play4fun 4 | # @File : DdkGoodsDetail.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkGoodsDetail.py: 9 | 10 | https://open.pinduoduo.com/application/document/api?id=pdd.ddk.goods.detail&permissionId=2 11 | """ 12 | 13 | from ddk.api.base import RestApi 14 | 15 | 16 | class DdkGoodsDetail(RestApi): 17 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 18 | RestApi.__init__(self, domain, port) 19 | 20 | # self.goods_id_list = None # 商品ID,仅支持单个查询。例如:[123456] 21 | self.goods_sign = None # 商品goodsSign,支持通过goodsSign查询商品。goodsSign是加密后的goodsId, goodsId已下线,请使用goodsSign来替代。使用说明:https://jinbao.pinduoduo.com/qa-system?questionId=252 22 | 23 | self.pid = None # 推广位id 24 | self.custom_parameters = None # 自定义参数 25 | self.search_id = None # 非必填 搜索id,建议填写,提高收益。来自pdd.ddk.goods.recommend.get、pdd.ddk.goods.search、pdd.ddk.top.goods.list.query等接口 26 | self.zs_duo_id = None # 非必填 招商多多客ID 27 | 28 | def getapiname(self): 29 | return 'pdd.ddk.goods.detail' 30 | -------------------------------------------------------------------------------- /测试/根据商品ID查询相关商品-商品推荐1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2019-03-07 19:18 3 | # @Author : play4fun 4 | # @File : 根据商品ID查询相关商品-商品推荐1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 根据商品ID查询相关商品-商品推荐1.py: 9 | 不行! 10 | 11 | 广西红心木瓜5斤/10斤 单果500g-1000g新鲜水果 12 | https://mobile.yangkeduo.com/goods2.html?goods_id=5905216563 13 | """ 14 | from pprint import pprint 15 | from ddk.api.rest.DdkGoodsSearch import DdkGoodsSearch 16 | from ddk import appinfo 17 | import traceback, json 18 | from config import pdd_client_id, pdd_client_secret 19 | 20 | 21 | def main(): 22 | req = DdkGoodsSearch() 23 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 24 | req.keyword = '【新品推荐】广西红心木瓜5斤/10斤 单果500g-1000g新鲜水果' 25 | req.page_size = 10 26 | # goods_id = '5905216563' # 27 | # req.goods_id_list = f'[{goods_id}]' # 28 | try: 29 | resp = req.getResponse() 30 | pprint(resp)#结果都是木瓜 31 | 32 | # print(json.dumps(f, ensure_ascii=False)) 33 | except Exception as e: 34 | print(e) 35 | print(traceback.format_exc()) 36 | 37 | 38 | if __name__ == '__main__': 39 | main() 40 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkThemePromUrlGenerate.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 17:44 3 | # @Author : play4fun 4 | # @File : DdkThemePromUrlGenerate.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkThemePromUrlGenerate.py: 9 | """ 10 | 11 | from ddk.api.base import RestApi 12 | 13 | 14 | class DdkThemePromUrlGenerate(RestApi): 15 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 16 | RestApi.__init__(self, domain, port) 17 | self.pid = None # 推广位 18 | self.theme_id_list = None # 主题ID列表,例如[1,235] 19 | self.generate_short_url = None # 是否生成短链接,true-是,false-否 20 | self.generate_mobile = None # 是否生成手机跳转链接,true-是,false-否 21 | 22 | self.custom_parameters = None # 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。 23 | self.generate_weapp_webview = None # 是否生成唤起微信客户端链接,true-是,false-否,默认false 24 | self.we_app_web_view_short_url = None # 唤起微信app推广短链接 25 | self.we_app_web_wiew_url = None # 唤起微信app推广链接 26 | # ? 27 | # self.generate_we_app: bool = None # 是否生成小程序推广 28 | 29 | def getapiname(self): 30 | return 'pdd.ddk.theme.prom.url.generate' 31 | -------------------------------------------------------------------------------- /测试/多多客工具生成转盘抽免单url1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 14:41 3 | # @Author : play4fun 4 | # @File : 多多客工具生成转盘抽免单url1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 多多客工具生成转盘抽免单url1.py: 9 | gw-api.pinduoduo.com/api/router?data_type=JSON&client_id=1350fc17ca6f4b0085db1b53cdb461ef&version=V1×tamp=1545117029&type=pdd.ddk.lottery.url 10 | .gen&sign=9ECA077875A13E55C804805F8F107473&pid_list=%5B%221000939_25578619%22%5D 11 | """ 12 | 13 | from ddk.api.rest.DdkLotteryUrlGen import DdkLotteryUrlGen 14 | from ddk import appinfo 15 | import traceback, json 16 | from config import pdd_client_id, pdd_client_secret, pid 17 | 18 | 19 | def test1(): 20 | req = DdkLotteryUrlGen() 21 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 22 | 23 | req.pid_list = f'["{pid}"]' 24 | 25 | try: 26 | resp = req.getResponse()#TODO 参数错误:您无权使用该接口 27 | print(resp) 28 | print('-' * 40) 29 | print(json.dumps(resp)) 30 | 31 | # print(json.dumps(f, ensure_ascii=False)) 32 | except Exception as e: 33 | print(e) 34 | print(traceback.format_exc()) 35 | 36 | 37 | if __name__ == '__main__': 38 | test1() 39 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkOrderListIncrementGet.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 14:56 3 | # @Author : play4fun 4 | # @File : DdkOrderListIncrementGet.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkOrderListIncrementGet.py: 9 | 10 | 最后更新时间段增量同步推广订单信息 11 | 12 | 按照时间段获取授权多多客下面所有多多客的推广订单信息 13 | """ 14 | 15 | from ddk.api.base import RestApi 16 | 17 | 18 | class DdkOrderListIncrementGet(RestApi): 19 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 20 | RestApi.__init__(self, domain, port) 21 | 22 | self.start_update_time: int = None # 最近90天内多多进宝商品订单更新时间--查询时间开始。note:此时间为时间戳,指格林威治时间 1970 年01 月 01 日 00 时 00 分 00 秒(北京时间 1970 年 01 月 01 日 08 时 23 | # 00 分 00 秒)起至现在的总秒数 24 | self.end_update_time: int = None # 查询结束时间,和开始时间相差不能超过24小时。note:此时间为时间戳,指格林威治时间 1970 年01 月 01 日 00 时 00 分 00 秒(北京时间 1970 年 01 月 01 日 08 时 00 分 00 秒)起至现在的总秒数 25 | self.page_size = None # 返回的每页结果订单数,默认为100,范围为10到100,建议使用40~50,可以提高成功率,减少超时数量。 26 | self.page = None # 第几页,从1到10000,默认1,注:使用最后更新时间范围增量同步时,必须采用倒序的分页方式(从最后一页往回取)才能避免漏单问题。 27 | self.return_count = None # 是否返回总数,默认为true,如果指定false, 则返回的结果中不包含总记录数,通过此种方式获取增量数据,效率在原有的基础上有80%的提升。 28 | 29 | def getapiname(self): 30 | return 'pdd.ddk.order.list.increment.get' 31 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkGoodsPromotionUrlGenerate.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 14:27 3 | # @Author : play4fun 4 | # @File : DdkGoodsPromotionUrlGenerate.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkGoodsPromotionUrlGenerate.py: 9 | 生成普通商品推广链接 10 | """ 11 | 12 | from ddk.api.base import RestApi 13 | 14 | 15 | class DdkGoodsPromotionUrlGenerate(RestApi): 16 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 17 | RestApi.__init__(self, domain, port) 18 | self.goods_id_list = None # 商品ID,仅支持单个查询。例如:[123456] 19 | self.p_id: int = None # 推广位id 20 | self.generate_short_url = None # 是否生成短链接,true-是,false-否 21 | self.multi_group = None # true--生成多人团推广链接 false--生成单人团推广链接(默认false)1、单人团推广链接:用户访问单人团推广链接,可直接购买商品无需拼团。2、多人团推广链接:用户访问双人团推广链接开团,若用户分享给他人参团,则开团者和参团者的佣金均结算给推手 22 | self.custom_parameters = None # 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。 23 | self.pull_new = None # 是否开启订单拉新,true表示开启(订单拉新奖励特权仅支持白名单,请联系工作人员开通) 24 | self.generate_weapp_webview = None # 是否生成唤起微信客户端链接,true-是,false-否,默认false 25 | self.zs_duo_id = None # 招商多多客ID 26 | self.generate_we_app: bool = None # 是否生成小程序推广 27 | 28 | def getapiname(self): 29 | return 'pdd.ddk.goods.promotion.url.generate' 30 | -------------------------------------------------------------------------------- /测试/创建多多进宝推广位1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-10 15:29 3 | # @Author : play4fun 4 | # @File : 创建多多进宝推广位1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 创建多多进宝推广位1.py: 9 | """ 10 | 11 | from ddk.api.rest.DdkGoodsPidGenerate import DdkGoodsPidGenerate 12 | from ddk import appinfo 13 | import traceback, json 14 | from config import pdd_client_id, pdd_client_secret 15 | 16 | 17 | def test1(): 18 | req = DdkGoodsPidGenerate() 19 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 20 | 21 | req.number = 2 22 | req.p_id_name_list = ['推广位1', '推广位2'] 23 | try: 24 | resp = req.getResponse() 25 | print(resp) 26 | print('-' * 40) 27 | print(json.dumps(resp)) 28 | 29 | # print(json.dumps(f, ensure_ascii=False)) 30 | except Exception as e: 31 | print(e) 32 | print(traceback.format_exc()) 33 | ''' 34 | {'p_id_generate_response': {'p_id_list': [ 35 | {'create_time': 1544427170, 36 | 'p_id': '1000939_44317601', 37 | 'pid_name': '推广位1'}, 38 | 39 | {'create_time': 1544427170, 40 | 'p_id': '1000939_44317602', 41 | 'pid_name': '推广位2'} 42 | ], 43 | 'request_id': '15444271701246078'}} 44 | ''' 45 | 46 | 47 | if __name__ == '__main__': 48 | test1() 49 | -------------------------------------------------------------------------------- /测试/查询已经生成的推广位信息1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 14:50 3 | # @Author : play4fun 4 | # @File : 查询已经生成的推广位信息1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 查询已经生成的推广位信息1.py: 9 | """ 10 | 11 | from ddk.api.rest.DdkGoodsPidQuery import DdkGoodsPidQuery 12 | from ddk import appinfo 13 | import traceback, json 14 | from config import pdd_client_id, pdd_client_secret 15 | 16 | 17 | def test1(): 18 | req = DdkGoodsPidQuery() 19 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 20 | 21 | req.page_size = 100 22 | try: 23 | resp = req.getResponse() 24 | print(resp,len(resp['p_id_query_response']['p_id_list'])) 25 | print('-' * 40) 26 | print(json.dumps(resp)) 27 | 28 | # print(json.dumps(f, ensure_ascii=False)) 29 | except Exception as e: 30 | print(e) 31 | print(traceback.format_exc()) 32 | ''' 33 | { 34 | "p_id_query_response": { 35 | "p_id_list": [ 36 | { 37 | "create_time": 1544024512, 38 | "pid_name": "推广位1860731_43745459", 39 | "p_id": "1860731_43745459" 40 | }, 41 | { 42 | "create_time": 1532571981, 43 | "pid_name": "tgw1", 44 | "p_id": "1860731_21505724" 45 | } 46 | ], 47 | "total_count": 2, 48 | "request_id": "15443382778507289" 49 | } 50 | } 51 | ''' 52 | 53 | if __name__ == '__main__': 54 | test1() 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | config.py 106 | -------------------------------------------------------------------------------- /ddk/api/rest/DdkGoodsSearch.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 14:02 3 | # @Author : play4fun 4 | # @File : DdkGoodsSearch.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | DdkGoodsSearch.py: 9 | 10 | 2021 11 | 12 | https://jinbao.pinduoduo.com/third-party/api-detail?apiName=pdd.ddk.goods.search 13 | 多多进宝商品查询 14 | 15 | 16 | https://jinbao.pinduoduo.com/qa-system?questionId=219 17 | 授权备案成功后,为何pdd.ddk.goods.search接口还是返回未备案报错? 18 | 仔细检查一下pdd.ddk.goods.search传入的pid+custom_parameters和生成备案链接的入参pid+custom_parameters是否一致,可能是pid漏传或者custom_parameters漏传了。 19 | 20 | """ 21 | 22 | from ddk.api.base import RestApi 23 | 24 | 25 | class DdkGoodsSearch(RestApi): 26 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 27 | RestApi.__init__(self, domain, port) 28 | self.keyword = None # 商品关键词,与opt_id字段选填一个或全部填写 29 | 30 | self.page_size = None # 默认100,每页商品数量 31 | self.sort_type = None # 排序方式:0-综合排序;1-按佣金比率升序;2-按佣金比例降序;3-按价格升序;4-按价格降序;5-按销量升序;6-按销量降序;7-优惠券金额排序升序;8-优惠券金额排序降序;9-券后价升序排序;10-券后价降序排序;11-按照加入多多进宝时间升序;12-按照加入多多进宝时间降序;13-按佣金金额升序排序;14-按佣金金额降序排序;15-店铺描述评分升序;16-店铺描述评分降序;17-店铺物流评分升序;18-店铺物流评分降序;19-店铺服务评分升序;20-店铺服务评分降序;27-描述评分击败同类店铺百分比升序,28-描述评分击败同类店铺百分比降序,29-物流评分击败同类店铺百分比升序,30-物流评分击败同类店铺百分比降序,31-服务评分击败同类店铺百分比升序,32-服务评分击败同类店铺百分比降序 32 | self.with_coupon = None # false返回所有商品,true只返回有优惠券的商品 33 | self.range_list = None # 34 | self.cat_id = None # 商品类目ID,使用pdd.goods.cats.get接口获取 35 | self.goods_id_list = None # 商品ID列表。例如:[123456,123],当入参带有goods_id_list字段,将不会以opt_id、 cat_id、keyword维度筛选商品 36 | self.zs_duo_id = None # 招商多多客ID 37 | self.merchant_type = None # 店铺类型,1-个人,2-企业,3-旗舰店,4-专卖店,5-专营店,6-普通店(未传为全部) 38 | 39 | self.pid = None # 推广位id 40 | self.custom_parameters = None # 自定义参数 41 | 42 | def getapiname(self): 43 | return 'pdd.ddk.goods.search' 44 | -------------------------------------------------------------------------------- /测试/多多客工具生成店铺推广链接API1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 16:33 3 | # @Author : play4fun 4 | # @File : 多多客工具生成店铺推广链接API1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 多多客工具生成店铺推广链接API1.py: 9 | 10 | pdd.ddk.mall.url.gen 11 | DdkMallUrlGen 12 | 13 | """ 14 | 15 | from ddk.api.rest.DdkMallUrlGen import DdkMallUrlGen 16 | from ddk import appinfo 17 | import traceback, json 18 | from config import pdd_client_id, pdd_client_secret, pid 19 | 20 | 21 | def test1(): 22 | req = DdkMallUrlGen() 23 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 24 | # 25 | req.mall_id = 327071922 26 | req.pid = pid 27 | req.generate_short_url = True 28 | try: 29 | resp = req.getResponse() 30 | print(resp) 31 | print('-' * 40) 32 | print(json.dumps(resp)) 33 | 34 | # print(json.dumps(f, ensure_ascii=False)) 35 | except Exception as e: 36 | print(e) 37 | print(traceback.format_exc()) 38 | ''' 39 | { 40 | "mall_coupon_generate_url_response": { 41 | "list": [ 42 | { 43 | "mobile_url": "https://mobile.yangkeduo.com/app.html?launch_url=duo_mall_coupon.html%3Fmall_id%3D327071922%26pid%3D1000939_25578619%26cpsSign%3DCW1000939_25578619_a16d7fc7cc017dd272eb69abe7db845f%26duoduo_type%3D2", 44 | "mobile_short_url": "https://p.pinduoduo.com/aTJmF5ZI", 45 | "we_app_web_view_url": "https://mobile.yangkeduo.com/duo_mall_coupon.html?mall_id=327071922&pid=1000939_25578619&cpsSign=CW1000939_25578619_a16d7fc7cc017dd272eb69abe7db845f&duoduo_type=2&launch_wx=1", 46 | "url": "https://mobile.yangkeduo.com/duo_mall_coupon.html?mall_id=327071922&pid=1000939_25578619&cpsSign=CW1000939_25578619_a16d7fc7cc017dd272eb69abe7db845f&duoduo_type=2", 47 | "short_url": "https://p.pinduoduo.com/A1dmTylb", 48 | "we_app_web_view_short_url": "https://p.pinduoduo.com/HX7mT8zd" 49 | } 50 | ], 51 | "request_id": "15451223844650882" 52 | } 53 | } 54 | ''' 55 | 56 | 57 | if __name__ == '__main__': 58 | test1() 59 | -------------------------------------------------------------------------------- /测试/查询订单详情1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-10 15:13 3 | # @Author : play4fun 4 | # @File : 查询订单详情1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 查询订单详情1.py: 9 | """ 10 | 11 | 12 | from ddk.api.rest.DdkOrderDetailGet import DdkOrderDetailGet 13 | from ddk import appinfo 14 | import traceback,json 15 | from config import pdd_client_id,pdd_client_secret 16 | 17 | def test1(): 18 | req = DdkOrderDetailGet() 19 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 20 | 21 | req.order_sn = '181116-236494521293864' 22 | try: 23 | resp = req.getResponse() 24 | print(resp) 25 | print('-' * 40) 26 | print(json.dumps(resp)) 27 | 28 | # print(json.dumps(f, ensure_ascii=False)) 29 | except Exception as e: 30 | print(e) 31 | print(traceback.format_exc()) 32 | ''' 33 | {'order_detail_response': {'auth_duo_id': 0, 34 | 'batch_no': '', 35 | 'cps_sign': 'CC1000939_25578619_80c3d6ab8a4d5b1624dc5f3fa40ba9ff', 36 | 'custom_parameters': '', 37 | 'duo_coupon_amount': 0, 38 | 'goods_id': 558132, 39 | 'goods_name': '健美创研【10支装】 植物香氛护手霜300g补水滋润保湿美白防干裂', 40 | 'goods_price': 990, 41 | 'goods_quantity': 1, 42 | 'goods_thumbnail_url': 'http://t00img.yangkeduo.com/goods/images/2018-10-22/e925771ccad5dbcc30f1397769fd69d5.jpeg', 43 | 'group_id': 580236494521293864, 44 | 'match_channel': 0, 45 | 'order_amount': 990, 46 | 'order_create_time': 1542332625, 47 | 'order_group_success_time': 1542332629, 48 | 'order_modify_at': 1543911073, 49 | 'order_pay_time': 1542332629, 50 | 'order_receive_time': 1542600778, 51 | 'order_settle_time': None, 52 | 'order_sn': '181116-236494521293864', 53 | 'order_status': 3, 54 | 'order_status_desc': '审核通过', 55 | 'order_verify_time': 1543911073, 56 | 'pid': '1000939_25578619', 57 | 'point_time': None, 58 | 'promotion_amount': 446, 59 | 'promotion_rate': 450, 60 | 'request_id': '15444260975442285', 61 | 'return_status': 0, 62 | 'type': 0, 63 | 'url_last_generate_time': 1542334241, 64 | 'zs_duo_id': None}} 65 | ''' 66 | 67 | 68 | if __name__ == '__main__': 69 | test1() -------------------------------------------------------------------------------- /测试/多多进宝转链接口1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-14 17:35 3 | # @Author : play4fun 4 | # @File : 多多进宝转链接口1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 多多进宝转链接口1.py: 9 | 把别人的转链,转成自己的 10 | """ 11 | 12 | from ddk.api.rest.DdkGoodsZsUnitUrlGen import DdkGoodsZsUnitUrlGen 13 | from ddk import appinfo 14 | import traceback, json 15 | from config import pdd_client_id, pdd_client_secret, pid 16 | 17 | 18 | def test1(): 19 | req = DdkGoodsZsUnitUrlGen() 20 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 21 | # goods_id='4532814226,2478116379'#参数错误:只支持单个goodsId查询 22 | req.pid = pid 23 | # req.source_url = "https://p.pinduoduo.com/HXPmFuSx" 24 | req.source_url = "https://mobile.yangkeduo.com/duo_coupon_landing.html?goods_id=2478116379&pid=1000939_25578619&cpsSign=CC1000939_25578619_80c3d6ab8a4d5b1624dc5f3fa40ba9ff&duoduo_type=3" 25 | try: 26 | resp = req.getResponse() 27 | print(resp) 28 | print('-' * 40) 29 | print(json.dumps(resp)) 30 | 31 | # print(json.dumps(f, ensure_ascii=False)) 32 | except Exception as e: 33 | print(e) 34 | print(traceback.format_exc()) 35 | ''' 36 | { 37 | "goods_zs_unit_generate_response": { 38 | "multi_group_url": "https://mobile.yangkeduo.com/duo_coupon_landing.html?goods_id=2478116379&pid=1860931_43746459&cpsSign=CC1860931_43746459_01cb1d6f45ae5bc9d01581525853593e&duoduo_type=3", 39 | "multi_group_mobile_short_url": "https://p.pinduoduo.com/ctzmcX8k", 40 | "mobile_url": "https://mobile.yangkeduo.com/app.html?launch_url=duo_coupon_landing.html%3Fgoods_id%3D2478116379%26pid%3D1860931_43746459%26cpsSign%3DCC1860931_43746459_01cb1d6f45ae5bc9d01581525853593e%26duoduo_type%3D2", 41 | "multi_group_short_url": "https://p.pinduoduo.com/svsmce9Z", 42 | "mobile_short_url": "https://p.pinduoduo.com/DzKmcClj", 43 | "multi_group_mobile_url": "https://mobile.yangkeduo.com/app.html?launch_url=duo_coupon_landing.html%3Fgoods_id%3D2478116379%26pid%3D1860931_43746459%26cpsSign%3DCC1860931_43746459_01cb1d6f45ae5bc9d01581525853593e%26duoduo_type%3D3", 44 | "request_id": "15447806742539308", 45 | "url": "https://mobile.yangkeduo.com/duo_coupon_landing.html?goods_id=2478116379&pid=1860931_43746459&cpsSign=CC1860931_43746459_01cb1d6f45ae5bc9d01581525853593e&duoduo_type=2", 46 | "short_url": "https://p.pinduoduo.com/WF8mc1iB" 47 | } 48 | } 49 | ''' 50 | 51 | 52 | if __name__ == '__main__': 53 | test1() 54 | -------------------------------------------------------------------------------- /测试/同步推广订单列表1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-10 14:25 3 | # @Author : play4fun 4 | # @File : 同步推广订单列表1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 同步推广订单列表1.py: 9 | """ 10 | 11 | from ddk.api.rest.DdkOrderListIncrementGet import DdkOrderListIncrementGet 12 | from ddk import appinfo 13 | import traceback, json 14 | from config import pdd_client_id, pdd_client_secret 15 | from datetime import datetime, timedelta 16 | 17 | 18 | def test1(): 19 | req = DdkOrderListIncrementGet() 20 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 21 | 22 | # req.start_update_time = 1543903041 #有订单 23 | # req.end_update_time = 1543988976 24 | 25 | start_update_time = int((datetime.now() - timedelta(days=1)).timestamp()) 26 | req.start_update_time = start_update_time # 1天前,时间跨度不能超过24小时 27 | req.end_update_time = int(datetime.now().timestamp()) 28 | # req.return_count = True 29 | try: 30 | resp = req.getResponse() 31 | print(resp) 32 | print('-' * 40) 33 | print(json.dumps(resp)) 34 | 35 | # print(json.dumps(f, ensure_ascii=False)) 36 | except Exception as e: 37 | print(e) 38 | print(traceback.format_exc()) 39 | # {'error_response': {'error_msg': '时间跨度不能超过24小时', 'sub_msg': '时间跨度不能超过24小时', 'sub_code': None, 'error_code': 50001, 'request_id': '15444234942269219'}} 40 | ''' 41 | {'order_list_get_response': {'order_list': [{'auth_duo_id': 0, 42 | 'batch_no': '', 43 | 'custom_parameters': '', 44 | 'duo_coupon_amount': 0, 45 | 'goods_id': 558132, 46 | 'goods_name': '健美创研【10支装】 植物香氛护手霜300g补水滋润保湿美白防干裂', 47 | 'goods_price': 990, 48 | 'goods_quantity': 1, 49 | 'goods_thumbnail_url': 'http://t00img.yangkeduo.com/goods/images/2018-10-22/e925771ccad5dbcc30f1397769fd69d5.jpeg', 50 | 'group_id': 580236494521293864, 51 | 'match_channel': 0, 52 | 'order_amount': 990, 53 | 'order_create_time': 1542332625, 54 | 'order_group_success_time': 1542332629, 55 | 'order_modify_at': 1543911073, 56 | 'order_pay_time': 1542332629, 57 | 'order_receive_time': 1542600778, 58 | 'order_settle_time': None, 59 | 'order_sn': '181116-236494521293864', 60 | 'order_status': 3, 61 | 'order_status_desc': '审核通过', 62 | 'order_verify_time': 1543911073, 63 | 'p_id': '1000939_25578619', 64 | 'promotion_amount': 446, 65 | 'promotion_rate': 450, 66 | 'type': 0, 67 | 'verify_time': 1543911073000, 68 | 'zs_duo_id': None}], 69 | 'request_id': '15444251942090810', 70 | 'total_count': 1}} 71 | ''' 72 | 73 | 74 | if __name__ == '__main__': 75 | test1() 76 | -------------------------------------------------------------------------------- /测试/商品关键词搜索1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 14:12 3 | # @Author : play4fun 4 | # @File : 商品关键词搜索1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 商品关键词搜索1.py: 9 | 10 | 2021-4-1 问题 11 | ddk.api.base.DdkException: errorcode=None message=None subcode=60001 12 | submsg=未传入已经授权备案过的相关参数(pid/custom_parameters), 13 | 授权备案说明链接:https://jinbao.pinduoduo.com/qa-system?questionId=204 14 | application_host= service_host= 15 | 16 | """ 17 | from pprint import pprint 18 | from ddk.api.rest.DdkGoodsSearch import DdkGoodsSearch 19 | from ddk import appinfo 20 | import traceback, json 21 | from config import pdd_client_id, pdd_client_secret 22 | 23 | 24 | def test1(): 25 | req = DdkGoodsSearch() 26 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 27 | req.keyword = '美食' 28 | 29 | # goods_id='2478116379' 30 | # req.goods_id_list = f'[{goods_id}]'#会返回这一条,只有1条 31 | 32 | req.page_size = 10 33 | 34 | #TODO 35 | req.pid = '1860931_129508134' 36 | req.custom_parameters = '{"uid":"1860931"}' #多多客ID '1860931' 37 | 38 | try: 39 | resp = req.getResponse() 40 | pprint(resp) 41 | 42 | # print(json.dumps(f, ensure_ascii=False)) 43 | except Exception as e: 44 | print(e) 45 | print(traceback.format_exc()) 46 | ''' 47 | {'avg_desc': 462, 48 | 'avg_lgst': 466, 49 | 'avg_serv': 467, 50 | 'cat_id': None, 51 | 'cat_ids': [17285, 17297, 17399, 0], 52 | 'category_id': 12, 53 | 'category_name': '海淘', 54 | 'coupon_discount': 100, 55 | 'coupon_end_time': 1544457599, 56 | 'coupon_min_order_amount': 100, 57 | 'coupon_remain_quantity': 8000, 58 | 'coupon_start_time': 1544198400, 59 | 'coupon_total_quantity': 10000, 60 | 'create_at': 1535875398, 61 | 'desc_pct': 0.1459, 62 | 'goods_desc': None, 63 | 'goods_eval_count': 303, 64 | 'goods_eval_score': 4.44, 65 | 'goods_gallery_urls': None, 66 | 'goods_id': 183245942, 67 | 'goods_image_url': 'http://omsproductionimg.yangkeduo.com/images/2017-11-08/e0fe9079e1ba8f4bd1e1eb7b6c27bdfe.jpeg', 68 | 'goods_name': '30包 20包 10包兰奇抽纸300张婴儿家庭本色批发整箱纸巾餐巾纸', 69 | 'goods_thumbnail_url': 'http://t00img.yangkeduo.com/goods/images/2018-11-12/c3609b5326927f699630273b40220046.jpeg', 70 | 'has_coupon': True, 71 | 'lgst_pct': 0.1573, 72 | 'mall_cps': 1, 73 | 'mall_id': 939972, 74 | 'mall_name': '兰奇纸业', 75 | 'mall_rate': 200, 76 | 'merchant_type': 1, 77 | 'min_group_price': 1251, 78 | 'min_normal_price': 1490, 79 | 'opt_id': 12, 80 | 'opt_ids': [292, 293, 357, 330, 12, 364, 223, 15], 81 | 'opt_name': '海淘', 82 | 'promotion_rate': 300, 83 | 'serv_pct': 0.18, 84 | 'sold_quantity': 13375} 85 | ''' 86 | 87 | 88 | if __name__ == '__main__': 89 | test1() 90 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DDK_SDK 2 | ## 拼多多-多多客联盟 CPS 工具包 3 | 4 | - 其他平台 5 | - [京东联盟](https://pypi.org/project/jd-union/) 6 | - [淘宝联盟](https://github.com/makelove/Taobao_topsdk) 7 | 8 | - 视频 9 | - [淘口令被微信屏蔽了?来看看拼多多的【多多客SDK】开放平台](https://www.bilibili.com/video/BV1QE411J7R7/) 10 | - [Python编程,写一个【QQ+拼多多】返现程序,在服务器上Docker运行](https://www.bilibili.com/video/BV15E411L7rk/) 11 | - [【编程】拼多多-多多客-开发者-SDK,多多进宝。Python](https://www.bilibili.com/video/BV1GK4y1m7q8/) 12 | 13 | - 官网 14 | - https://open.pinduoduo.com/#/index 15 | - 开发者文档 16 | - [多多客入驻指南](https://open.pinduoduo.com/#/document?title=%25E5%25A4%259A%25E5%25A4%259A%25E5%25AE%25A2%25E5%2585%25A5%25E9%25A9%25BB%25E6%258C%2587%25E5%258D%2597) 17 | - https://open.pinduoduo.com/#/document 18 | - 必须!第一步! 19 | - 6、打开多多进宝页面输入client_id,将其与多多客进行绑定。 20 | - 【多多进宝】 现在2021年需要实名认证,下载【多多进宝】App 21 | - 7、绑定成功后,便可成功获取多多客API权限。 22 | - 多多客API 23 | - https://open.pinduoduo.com/#/apidocument 24 | - 多多客权限包 25 | - http://open.pinduoduo.com/#/apidocument?port=5&id=2 26 | - 多多进宝 27 | - https://jinbao.pinduoduo.com/index 28 | 29 | - 常用API 30 | - [pdd.ddk.goods.detail多多进宝商品详情查询](https://open.pinduoduo.com/application/document/api?id=pdd.ddk.goods.detail&permissionId=2) 31 | - [GoodsSign接入使用](https://jinbao.pinduoduo.com/qa-system?questionId=252) 32 | - [多多进宝商品查询:pdd.ddk.goods.search](https://jinbao.pinduoduo.com/third-party/api-detail?apiName=pdd.ddk.goods.search) 33 | 34 | 35 | 36 | ## 注意事项 37 | - 公告 38 | - 2021-05-21 18:04:10 [关于多多客等级体系调整的通知](https://jinbao.pinduoduo.com/message/detail?crumbs=broadcast&id=11646079) 39 | - [自2021年3月31日起,平台将对长期未发布服务的已上线应用或服务资质进行限制处理](https://open.pinduoduo.com/application/document/announcement?id=159) 40 | - [授权备案](https://jinbao.pinduoduo.com/qa-system?questionId=204) 41 | - [如何授权备案?](https://jinbao.pinduoduo.com/qa-system?questionId=218) 42 | - [查询是否绑定备案:pdd.ddk.member.authority.query](https://jinbao.pinduoduo.com/third-party/api-detail?apiName=pdd.ddk.member.authority.query) 43 | - [生成营销工具推广链接:pdd.ddk.rp.prom.url.generate](https://jinbao.pinduoduo.com/third-party/api-detail?apiName=pdd.ddk.rp.prom.url.generate) 44 | 45 | - [多多进宝APP提现门槛降低至10元通知](https://jinbao.pinduoduo.com/message/detail?crumbs=broadcast&id=9851753) 46 | - 2021-03-14 17:54:57 47 | - 下载多多进宝官方APP,推广待提现余额满10元即可提现,无需等待,一键提现推广佣金。 48 | 49 | 50 | - 开发环境 51 | - python 3.6 52 | - 仿照 Taobao_topsdk 53 | - 安装 54 | - https://pypi.org/project/ddk/ 55 | - pip install ddk 56 | - pip install ddk --upgrade 57 | - 卸载 58 | - pip uninstall ddk 59 | 60 | - 交流 61 | - 加我微信:sexy8dream 62 | wechat_account 63 | 64 | - 扫码进群 65 | wechat_donate 66 | -------------------------------------------------------------------------------- /测试/多多进宝主题活动推广链接生成1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 17:43 3 | # @Author : play4fun 4 | # @File : 多多进宝主题活动推广链接生成1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 多多进宝主题活动推广链接生成1.py: 9 | 10 | DdkThemePromUrlGenerate 11 | 12 | """ 13 | 14 | from ddk.api.rest.DdkThemePromUrlGenerate import DdkThemePromUrlGenerate 15 | from ddk import appinfo 16 | import traceback, json 17 | from config import pdd_client_id, pdd_client_secret, pid 18 | 19 | 20 | def test1(): 21 | req = DdkThemePromUrlGenerate() 22 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 23 | # 24 | req.pid = pid 25 | req.theme_id_list = [3925, 3975] 26 | req.generate_short_url = True 27 | try: 28 | resp = req.getResponse() 29 | print(resp) 30 | print('-' * 40) 31 | print(json.dumps(resp)) 32 | 33 | # print(json.dumps(f, ensure_ascii=False)) 34 | except Exception as e: 35 | print(e) 36 | print(traceback.format_exc()) 37 | ''' 38 | { 39 | "theme_promotion_url_generate_response": { 40 | "url_list": [ 41 | { 42 | "multi_we_app_web_view_url": "https://mobile.yangkeduo.com/duo_theme_activity.html?themeId=3925&pid=1860931_43746459&cpsSign=CT1860931_43746459_55b94304f7ead939318bad121c195dac&duoduo_type=3&launch_wx=1", 43 | "multi_group_mobile_short_url": null, 44 | "mobile_url": null, 45 | "multi_we_app_web_view_short_url": null, 46 | "multi_group_mobile_url": null, 47 | "url": "https://mobile.yangkeduo.com/duo_theme_activity.html?themeId=3925&pid=1860931_43746459&cpsSign=CT1860931_43746459_55b94304f7ead939318bad121c195dac&duoduo_type=2", 48 | "short_url": "https://p.pinduoduo.com/ATomTqec", 49 | "multi_group_url": "https://mobile.yangkeduo.com/duo_theme_activity.html?themeId=3925&pid=1860931_43746459&cpsSign=CT1860931_43746459_55b94304f7ead939318bad121c195dac&duoduo_type=3", 50 | "multi_group_short_url": "https://p.pinduoduo.com/QdKmFl8h", 51 | "we_app_info": null, 52 | "mobile_short_url": null, 53 | "we_app_web_view_url": "https://mobile.yangkeduo.com/duo_theme_activity.html?themeId=3925&pid=1860931_43746459&cpsSign=CT1860931_43746459_55b94304f7ead939318bad121c195dac&duoduo_type=2&launch_wx=1", 54 | "we_app_web_view_short_url": "https://p.pinduoduo.com/OoymcRVm" 55 | }, 56 | { 57 | "multi_we_app_web_view_url": "https://mobile.yangkeduo.com/duo_theme_activity.html?themeId=3975&pid=1860931_43746459&cpsSign=CT1860931_43746459_55b94304f7ead939318bad121c195dac&duoduo_type=3&launch_wx=1", 58 | "multi_group_mobile_short_url": null, 59 | "mobile_url": null, 60 | "multi_we_app_web_view_short_url": null, 61 | "multi_group_mobile_url": null, 62 | "url": "https://mobile.yangkeduo.com/duo_theme_activity.html?themeId=3975&pid=1860931_43746459&cpsSign=CT1860931_43746459_55b94304f7ead939318bad121c195dac&duoduo_type=2", 63 | "short_url": "https://p.pinduoduo.com/1PBmFAaX", 64 | "multi_group_url": "https://mobile.yangkeduo.com/duo_theme_activity.html?themeId=3975&pid=1860931_43746459&cpsSign=CT1860931_43746459_55b94304f7ead939318bad121c195dac&duoduo_type=3", 65 | "multi_group_short_url": "https://p.pinduoduo.com/jX3mFH36", 66 | "we_app_info": null, 67 | "mobile_short_url": null, 68 | "we_app_web_view_url": "https://mobile.yangkeduo.com/duo_theme_activity.html?themeId=3975&pid=1860931_43746459&cpsSign=CT1860931_43746459_55b94304f7ead939318bad121c195dac&duoduo_type=2&launch_wx=1", 69 | "we_app_web_view_short_url": "https://p.pinduoduo.com/VJLmFGH8" 70 | } 71 | ], 72 | "request_id": "15451265248810004" 73 | } 74 | } 75 | ''' 76 | 77 | 78 | if __name__ == '__main__': 79 | test1() 80 | -------------------------------------------------------------------------------- /测试/多多进宝主题列表查询1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 17:03 3 | # @Author : play4fun 4 | # @File : 多多进宝主题列表查询1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 多多进宝主题列表查询1.py: 9 | pdd.ddk.theme.list.get 10 | DdkThemeListGet 11 | 12 | """ 13 | 14 | from ddk.api.rest.DdkThemeListGet import DdkThemeListGet 15 | from ddk import appinfo 16 | import traceback, json 17 | from config import pdd_client_id, pdd_client_secret 18 | 19 | 20 | def test1(): 21 | req = DdkThemeListGet() 22 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 23 | # 24 | req.page_size = 10 25 | req.page = 1 26 | 27 | try: 28 | resp = req.getResponse() 29 | print(resp) 30 | print('-' * 40) 31 | print(json.dumps(resp)) 32 | 33 | # print(json.dumps(f, ensure_ascii=False)) 34 | except Exception as e: 35 | print(e) 36 | print(traceback.format_exc()) 37 | ''' 38 | { 39 | "theme_list_get_response": { 40 | "total": 70, 41 | "theme_list": [ 42 | { 43 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-17/2fde3277dfc3e9f896fe3873e2cdb681.jpg", 44 | "name": "俊狮男装品牌清仓!", 45 | "goods_num": 20, 46 | "id": 3975, 47 | "type": 1 48 | }, 49 | { 50 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-16/eda7ba24a95a686472a91f9a6b6409d0.jpg", 51 | "name": "茜舞大牌返场 全场低至1折起", 52 | "goods_num": 21, 53 | "id": 3949, 54 | "type": 1 55 | }, 56 | { 57 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-15/1ba0e848a1b143a25c22fe62615b15e3.jpg", 58 | "name": "印象童年保暖童装低至29元起", 59 | "goods_num": 19, 60 | "id": 3925, 61 | "type": 1 62 | }, 63 | { 64 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-14/d0bcc58eb1f8955fa2a75c42c06f2816.jpg", 65 | "name": "喝好茶 送好礼", 66 | "goods_num": 70, 67 | "id": 3922, 68 | "type": 1 69 | }, 70 | { 71 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-13/6741f085d1576406a47655fc60a9596f.jpg", 72 | "name": "卓诗尼冬日清仓1214", 73 | "goods_num": 17, 74 | "id": 3909, 75 | "type": 1 76 | }, 77 | { 78 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-12/2c791099d407f0d6236c0ce0196e38b6.jpg", 79 | "name": "塔丹奴年终大促 打破底价1折起", 80 | "goods_num": 0, 81 | "id": 3897, 82 | "type": 1 83 | }, 84 | { 85 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-12/76089cd44deb35b4b3671f578b3e2050.jpg", 86 | "name": "坚果暖冬大聚惠", 87 | "goods_num": 61, 88 | "id": 3564, 89 | "type": 1 90 | }, 91 | { 92 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-11/d19a8df8e56e1993dd82e79e097916fb.jpg", 93 | "name": "jeepspirit男装清仓1212", 94 | "goods_num": 18, 95 | "id": 3877, 96 | "type": 1 97 | }, 98 | { 99 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-10/805378efa93909c3b194743544218dd3.jpg", 100 | "name": "one more 低至0.6折起", 101 | "goods_num": 15, 102 | "id": 3857, 103 | "type": 1 104 | }, 105 | { 106 | "image_url": "http://t16img.yangkeduo.com/pdd_oms/2018-12-09/c5c943f4a5c4c4bb15cb4c58b19c8bf5.jpg", 107 | "name": "芊艺女装 品牌特卖1折起", 108 | "goods_num": 24, 109 | "id": 3841, 110 | "type": 1 111 | } 112 | ], 113 | "request_id": "15451240342488254" 114 | } 115 | } 116 | ''' 117 | 118 | if __name__ == '__main__': 119 | test1() 120 | -------------------------------------------------------------------------------- /测试/生成红包推广链接1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-10 15:45 3 | # @Author : play4fun 4 | # @File : 生成红包推广链接1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 生成红包推广链接1.py: 9 | """ 10 | 11 | 12 | from ddk.api.rest.DdkRpPromUrlGenerate import DdkRpPromUrlGenerate 13 | from ddk import appinfo 14 | import traceback,json 15 | from config import pdd_client_id,pdd_client_secret 16 | 17 | def test1(): 18 | req = DdkRpPromUrlGenerate() 19 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 20 | 21 | req.p_id_list = '["1860931_44317832","1860931_44317831"]' 22 | req.generate_short_url = True 23 | req.generate_we_app = True 24 | req.we_app_web_view_short_url = True 25 | try: 26 | resp = req.getResponse() 27 | print(resp) 28 | print('-' * 40) 29 | print(json.dumps(resp)) 30 | 31 | # print(json.dumps(f, ensure_ascii=False)) 32 | except Exception as e: 33 | print(e) 34 | print(traceback.format_exc()) 35 | ''' 36 | {'rp_promotion_url_generate_response': {'request_id': '15444280836807780', 37 | 'url_list': [{'mobile_short_url': 'https://p.pinduoduo.com/TY7mctJv', 38 | 'mobile_url': 'https://mobile.yangkeduo.com/app.html?launch_url=duo_red_packet.html%3Fpid%3D1860931_44317832%26cpsSign%3DCR1860931_44317832_04e872d20ecfcb932048c209616a0096%26duoduo_type%3D2', 39 | 'multi_group_mobile_short_url': 'https://p.pinduoduo.com/y5SmygVa', 40 | 'multi_group_mobile_url': 'https://mobile.yangkeduo.com/app.html?launch_url=duo_red_packet.html%3Fpid%3D1860931_44317832%26cpsSign%3DCR1860931_44317832_04e872d20ecfcb932048c209616a0096%26duoduo_type%3D3', 41 | 'multi_group_short_url': 'https://p.pinduoduo.com/WJgmchVm', 42 | 'multi_group_url': 'https://mobile.yangkeduo.com/duo_red_packet.html?pid=1860931_44317832&cpsSign=CR1860931_44317832_04e872d20ecfcb932048c209616a0096&duoduo_type=3', 43 | 'multi_we_app_web_view_short_url': 'https://p.pinduoduo.com/y5SmygVa', 44 | 'multi_we_app_web_view_url': 'https://mobile.yangkeduo.com/duo_red_packet.html?pid=1860931_44317832&cpsSign=CR1860931_44317832_04e872d20ecfcb932048c209616a0096&duoduo_type=3&launch_wx=1', 45 | 'short_url': 'https://p.pinduoduo.com/TqpmyxD9', 46 | 'url': 'https://mobile.yangkeduo.com/duo_red_packet.html?pid=1860931_44317832&cpsSign=CR1860931_44317832_04e872d20ecfcb932048c209616a0096&duoduo_type=2', 47 | 'we_app_info': {'app_id': 'wx32540bd863b27570', 48 | 'banner_url': None, 49 | 'desc': '拼多多,多实惠,多乐趣。', 50 | 'page_path': 'package_b/duoduo_envelope/duoduo_envelope?pid=1860931_44317832&cpsSign=CR1860931_44317832_04e872d20ecfcb932048c209616a0096&duoduo_type=2', 51 | 'source_display_name': '拼多多', 52 | 'title': '送你个红包,快来领吧', 53 | 'user_name': 'gh_0e7477744313@app', 54 | 'we_app_icon_url': 'http://xcxcdn.yangkeduo.com/pdd_logo.png'}, 55 | 'we_app_web_view_short_url': 'https://p.pinduoduo.com/APqmF4yp', 56 | 'we_app_web_view_url': 'https://mobile.yangkeduo.com/duo_red_packet.html?pid=1860931_44317832&cpsSign=CR1860931_44317832_04e872d20ecfcb932048c209616a0096&duoduo_type=2&launch_wx=1'}, 57 | {'mobile_short_url': 'https://p.pinduoduo.com/ALVmclZj', 58 | 'mobile_url': 'https://mobile.yangkeduo.com/app.html?launch_url=duo_red_packet.html%3Fpid%3D1860931_44317831%26cpsSign%3DCR1860931_44317831_92b7c4eea1f4b82c7dbcfa106ce2396a%26duoduo_type%3D2', 59 | 'multi_group_mobile_short_url': 'https://p.pinduoduo.com/4dSmcEYW', 60 | 'multi_group_mobile_url': 'https://mobile.yangkeduo.com/app.html?launch_url=duo_red_packet.html%3Fpid%3D1860931_44317831%26cpsSign%3DCR1860931_44317831_92b7c4eea1f4b82c7dbcfa106ce2396a%26duoduo_type%3D3', 61 | 'multi_group_short_url': 'https://p.pinduoduo.com/lssmy0cZ', 62 | 'multi_group_url': 'https://mobile.yangkeduo.com/duo_red_packet.html?pid=1860931_44317831&cpsSign=CR1860931_44317831_92b7c4eea1f4b82c7dbcfa106ce2396a&duoduo_type=3', 63 | 'multi_we_app_web_view_short_url': 'https://p.pinduoduo.com/4dSmcEYW', 64 | 'multi_we_app_web_view_url': 'https://mobile.yangkeduo.com/duo_red_packet.html?pid=1860931_44317831&cpsSign=CR1860931_44317831_92b7c4eea1f4b82c7dbcfa106ce2396a&duoduo_type=3&launch_wx=1', 65 | 'short_url': 'https://p.pinduoduo.com/Xmmmc90U', 66 | 'url': 'https://mobile.yangkeduo.com/duo_red_packet.html?pid=1860931_44317831&cpsSign=CR1860931_44317831_92b7c4eea1f4b82c7dbcfa106ce2396a&duoduo_type=2', 67 | 'we_app_info': {'app_id': 'wx32540bd863b27570', 68 | 'banner_url': None, 69 | 'desc': '拼多多,多实惠,多乐趣。', 70 | 'page_path': 'package_b/duoduo_envelope/duoduo_envelope?pid=1860931_44317831&cpsSign=CR1860931_44317831_92b7c4eea1f4b82c7dbcfa106ce2396a&duoduo_type=2', 71 | 'source_display_name': '拼多多', 72 | 'title': '送你个红包,快来领吧', 73 | 'user_name': 'gh_0e7477744313@app', 74 | 'we_app_icon_url': 'http://xcxcdn.yangkeduo.com/pdd_logo.png'}, 75 | 'we_app_web_view_short_url': 'https://p.pinduoduo.com/crUmyp2G', 76 | 'we_app_web_view_url': 'https://mobile.yangkeduo.com/duo_red_packet.html?pid=1860931_44317831&cpsSign=CR1860931_44317831_92b7c4eea1f4b82c7dbcfa106ce2396a&duoduo_type=2&launch_wx=1'}]}} 77 | ''' 78 | 79 | if __name__ == '__main__': 80 | test1() -------------------------------------------------------------------------------- /测试/获取商品信息1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 13:01 3 | # @Author : play4fun 4 | # @File : 获取商品信息1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 获取商品信息1.py: 9 | 10 | 11 | promotion_rate 佣金比例,千分比 12 | 佣金=成交价x佣金比例/1000 单位为分 13 | 14 | min_group_price 最低价sku的拼团价,单位为分 15 | min_normal_price 最低价sku的单买价,单位为分 16 | 17 | 转链后 18 | https://mobile.yangkeduo.com/duo_coupon_landing.html?goods_id=344663340973&pid=1860931_197796447&goods_sign=E9j28lXHyTlGSjrVwvfa_LAGVflKJo_x_JQxaEVdW6j&zs_duo_id=25436963&cpsSign=CC_220511_1860931_197796447_5a031f10071b56bebb28fcc1a4fdcfdb&_x_ddjb_act=%7B%22st%22%3A%221%22%7D&duoduo_type=2 19 | 20 | https://blog.csdn.net/glorious_future/article/details/114996411 21 | 通过搜索接口,搜索接口的keyword是支持传goods_id的,返回来的商品详情是带着goods_sign的,这样我们就拿到了goods_sign了 22 | 23 | 24 | """ 25 | 26 | from ddk.api.rest.DdkGoodsDetail import DdkGoodsDetail 27 | from ddk import appinfo 28 | import traceback 29 | import json 30 | from config import pdd_client_id, pdd_client_secret 31 | from pprint import pprint 32 | 33 | 34 | def test1(): 35 | req = DdkGoodsDetail() 36 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 37 | 38 | # 过时 39 | # goods_id='4532814226,2478116379'#参数错误:只支持单个goodsId查询 40 | # goods_id = '73224807' # '608295467' 41 | 42 | sign = 'E9j28lXHyTlGSjrVwvfa_LAGVflKJo_x_JQxaEVdW6j' 43 | # sign = 'C4KXLHYA6AXF5RAWR3MOKHALRE_GEXDA' 44 | req.goods_sign = sign # OK 45 | try: 46 | resp = req.getResponse() 47 | pprint(resp) 48 | 49 | # print(json.dumps(f, ensure_ascii=False)) 50 | except Exception as e: 51 | print(e) 52 | print(traceback.format_exc()) 53 | ''' 54 | {'goods_detail_response': {'goods_details': 55 | [{'cat_ids': [8172, 8181, 8226], 56 | 'category_id': 10696, 57 | 'category_name': '海淘', 58 | 'coupon_discount': 400, 59 | 'coupon_end_time': 1617465599, 60 | 'coupon_min_order_amount': 400, 61 | 'coupon_remain_quantity': 42000, 62 | 'coupon_start_time': 1617120000, 63 | 'coupon_total_quantity': 50000, 64 | 'desc_txt': '高', 65 | 'goods_desc': '云南板栗贝贝南瓜10斤板栗味贝贝小南瓜宝宝辅食老南瓜10/5/3斤', 66 | 'goods_gallery_urls': ['https://img.pddpic.com/mms-material-img/2021-03-18/02a2f2ba-4c20-4e72-9fe0-c8ed2470c7a0.jpeg.a.jpeg', 67 | 'https://img.pddpic.com/mms-material-img/2021-03-04/07fa2be2-adf7-45a2-a77c-0303cf25f8bd.jpeg.a.jpeg', 68 | 'https://img.pddpic.com/mms-material-img/2021-03-04/77c71f19-80e7-42e7-a18d-ec097c92015d.jpeg.a.jpeg', 69 | 'https://img.pddpic.com/mms-material-img/2021-03-04/3f37b98a-f808-4cb7-9882-06563462ffb5.jpeg.a.jpeg', 70 | 'https://img.pddpic.com/mms-material-img/2021-03-07/068932ec-8c67-43eb-9447-d6314ca755f3.jpeg.a.jpeg', 71 | 'https://img.pddpic.com/mms-material-img/2021-03-07/477b41ce-908d-413c-9eab-f821b7a06526.jpeg.a.jpeg', 72 | 'https://img.pddpic.com/mms-material-img/2021-03-07/101a13a1-61d8-451f-84db-b71603d12dec.jpeg.a.jpeg', 73 | 'https://img.pddpic.com/mms-material-img/2021-03-04/174e9343-b6d0-4f8c-b7f8-ce7909f070eb.jpeg.a.jpeg', 74 | 'https://img.pddpic.com/mms-material-img/2021-03-04/8e7cb92b-866c-4959-a416-ad2d0d12dc77.jpeg.a.jpeg', 75 | 'https://img.pddpic.com/mms-material-img/2021-03-04/b52dda59-71d5-40d4-b0af-1c79a6e77994.jpeg.a.jpeg'], 76 | 'goods_id': 222575613798, 77 | 'goods_image_url': 'https://img.pddpic.com/mms-material-img/2021-03-18/02a2f2ba-4c20-4e72-9fe0-c8ed2470c7a0.jpeg.a.jpeg', 78 | 'goods_name': '云南板栗贝贝南瓜10斤板栗味贝贝小南瓜宝宝辅食老南瓜10/5/3斤', 79 | 'goods_sign': 'Y9X2kbjEqfJGSjrVwvfZUTm_mDXRAAKI_JQFsEOOZIj', 80 | 'goods_thumbnail_url': 'https://t00img.yangkeduo.com/goods/images/2021-03-18/ac0c94338b83d5b1c5cfc493078b8b20.jpeg', 81 | 'has_coupon': True, 82 | 'has_mall_coupon': False, 83 | 'lgst_txt': '高', 84 | 'mall_coupon_discount_pct': 0, 85 | 'mall_coupon_end_time': 0, 86 | 'mall_coupon_max_discount_amount': 0, 87 | 'mall_coupon_min_order_amount': 0, 88 | 'mall_coupon_remain_quantity': 0, 89 | 'mall_coupon_start_time': 0, 90 | 'mall_coupon_total_quantity': 0, 91 | 'mall_cps': 1, 92 | 'mall_id': 891464, 93 | 'mall_img_url': 'http://t16img.yangkeduo.com/pdd_ims/57951b6a06f626cac503643340156880.jpg', 94 | 'mall_name': '哈尼印象', 95 | 'merchant_type': 1, 96 | 'min_group_price': 990, 97 | 'min_normal_price': 1590, 98 | 'only_scene_auth': True, 99 | 'opt_id': 10696, 100 | 'opt_ids': [10723, 22884, 10696, 22280, 22281, 22921, 9419, 9451, 10700, 13, 9421, 12402, 8115, 151, 22879], 101 | 'opt_name': '海淘', 102 | 'plan_type': 4, 103 | 'predict_promotion_rate': 140, 104 | 'promotion_rate': 140, 105 | 'sales_tip': '6967', 106 | 'serv_txt': '高', 107 | 'service_tags': [9, 13], 108 | 'share_rate': 0, 109 | 'unified_tags': ['坏了包赔', 110 | '48小时发货'], 111 | 'video_urls': [], 112 | 'zs_duo_id': 8439561}], 113 | 'request_id': '16172464391342144'}} 114 | 115 | 116 | ''' 117 | 118 | 119 | if __name__ == '__main__': 120 | test1() 121 | -------------------------------------------------------------------------------- /测试/生成普通商品推广链接1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 14:32 3 | # @Author : play4fun 4 | # @File : 生成普通商品推广链接1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 生成普通商品推广链接1.py: 9 | """ 10 | 11 | from ddk.api.rest.DdkGoodsPromotionUrlGenerate import DdkGoodsPromotionUrlGenerate 12 | from ddk import appinfo 13 | import traceback, json 14 | from config import pdd_client_id, pdd_client_secret, pid 15 | 16 | 17 | def test1(): 18 | req = DdkGoodsPromotionUrlGenerate() 19 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 20 | 21 | goods_id = '59649770' # '608295467' 22 | req.goods_id_list = f'[{goods_id}]' # 23 | req.p_id = pid 24 | req.generate_short_url = True 25 | req.multi_group = True 26 | req.generate_we_app = True 27 | 28 | try: 29 | resp = req.getResponse() 30 | print(resp) 31 | print('-' * 40) 32 | print(json.dumps(resp, indent=2)) 33 | 34 | # print(json.dumps(f, ensure_ascii=False)) 35 | except Exception as e: 36 | print(e) 37 | print(traceback.format_exc()) 38 | ''' 39 | { 40 | "goods_promotion_url_generate_response": { 41 | "goods_promotion_url_list": [ 42 | { 43 | "mobile_url": "https://mobile.yangkeduo.com/app.html?launch_url=duo_coupon_landing.html%3Fgoods_id%3D2478116379%26pid%3D1860931_43746459%26cpsSign%3DCC1860931_43746459_01cb1d6f45ae5bc9d01581525853593e%26duoduo_type%3D3", 44 | "we_app_info": { 45 | "we_app_icon_url": "http://xcxcdn.yangkeduo.com/pdd_logo.png", 46 | "user_name": "gh_0e7477744313@app", 47 | "page_path": "pages/welfare_coupon/welfare_coupon?goods_id=2478116379&pid=1860931_43746459&cpsSign=CC1860931_43746459_01cb1d6f45ae5bc9d01581525853593e&duoduo_type=3", 48 | "banner_url": null, 49 | "source_display_name": "拼多多", 50 | "title": "【劲爆价】210g正品三金西瓜霜经典护龈牙膏 家庭装薄荷香型", 51 | "app_id": "wx32540bd863b27570", 52 | "desc": "拼多多,多实惠,多乐趣。" 53 | }, 54 | "mobile_short_url": "https://p.pinduoduo.com/ctzmcX8k", 55 | "we_app_web_view_url": "https://mobile.yangkeduo.com/duo_coupon_landing.html?goods_id=2478116379&pid=1860931_43746459&cpsSign=CC1860931_43746459_01cb1d6f45ae5bc9d01581525853593e&duoduo_type=3&launch_wx=1", 56 | "goods_detail": { 57 | "avg_desc": 473, 58 | "category_name": "海淘", 59 | "coupon_remain_quantity": 19000, 60 | "avg_serv": 475, 61 | "avg_lgst": 474, 62 | "serv_pct": 0.3734, 63 | "promotion_rate": 400, 64 | "sold_quantity": 531, 65 | "cat_ids": [ 66 | 17285, 67 | 17286, 68 | 17325, 69 | 0 70 | ], 71 | "coupon_min_order_amount": 300, 72 | "lgst_pct": 0.38, 73 | "category_id": 12, 74 | "mall_id": 1590059, 75 | "goods_eval_score": 4.69, 76 | "cat_id": null, 77 | "mall_name": "名康家居馆", 78 | "coupon_total_quantity": 20000, 79 | "desc_pct": 0.4086, 80 | "merchant_type": 1, 81 | "goods_name": "【劲爆价】210g正品三金西瓜霜经典护龈牙膏 家庭装薄荷香型", 82 | "goods_eval_count": 55, 83 | "goods_id": 2478116379, 84 | "goods_gallery_urls": [ 85 | "http://t00img.yangkeduo.com/goods/images/2018-08-01/b4f0ca07bcba9486b501944049d2d1a3.jpeg", 86 | "http://t00img.yangkeduo.com/goods/images/2018-08-01/408dc0b261e6a7c0e2c5ace66ccd3987.jpeg", 87 | "http://t00img.yangkeduo.com/goods/images/2018-08-01/38648c2a3c8124db97afbfacce87235d.jpeg", 88 | "http://t00img.yangkeduo.com/goods/images/2018-08-01/2a4ae46491e62bb10e215a57ad3efd43.jpeg", 89 | "http://t00img.yangkeduo.com/goods/images/2018-08-01/43f4ba6c94ce9e0e1b281c9cc731ae41.jpeg" 90 | ], 91 | "goods_desc": "【劲爆价】210g正品三金西瓜霜经典护龈牙膏 家庭装薄荷香型\n厂家正品", 92 | "opt_name": "海淘", 93 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-08-04/b40c7bad375943d178de8c87ee806cee.jpeg", 94 | "opt_id": 12, 95 | "opt_ids": [ 96 | 292, 97 | 293, 98 | 328, 99 | 923, 100 | 12, 101 | 223, 102 | 15 103 | ], 104 | "goods_image_url": "http://t00img.yangkeduo.com/goods/images/2018-08-01/52d8afe92e28104f3ac03fbf917a78f8.jpeg", 105 | "min_normal_price": 1990, 106 | "has_coupon": true, 107 | "mall_rate": 100, 108 | "create_at": 1533372520, 109 | "min_group_price": 990, 110 | "mall_cps": 1, 111 | "coupon_start_time": 1543766400, 112 | "coupon_discount": 300, 113 | "coupon_end_time": 1546271999 114 | }, 115 | "url": "https://mobile.yangkeduo.com/duo_coupon_landing.html?goods_id=2478116379&pid=1860931_43746459&cpsSign=CC1860931_43746459_01cb1d6f45ae5bc9d01581525853593e&duoduo_type=3", 116 | "short_url": "https://p.pinduoduo.com/svsmce9Z", 117 | "we_app_web_view_short_url": "https://p.pinduoduo.com/ranmyGCa" 118 | } 119 | ], 120 | "request_id": "15443375918044319" 121 | } 122 | } 123 | ''' 124 | 125 | 126 | if __name__ == '__main__': 127 | test1() 128 | -------------------------------------------------------------------------------- /ddk/api/base.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-09 11:50 3 | # @Author : play4fun 4 | # @File : base.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | base.py: 9 | """ 10 | 11 | try: 12 | import httplib 13 | except ImportError: 14 | import http.client as httplib 15 | import urllib 16 | import time 17 | import hashlib 18 | import json 19 | import ddk 20 | import itertools 21 | import mimetypes 22 | 23 | ''' 24 | 定义一些系统变量 25 | ''' 26 | 27 | SYSTEM_GENERATE_VERSION = "ddk-sdk-python-20181209" 28 | 29 | P_APPKEY = "client_id" 30 | P_API = "type" 31 | P_SESSION = "session" 32 | P_ACCESS_TOKEN = "access_token" 33 | P_VERSION = "version" 34 | P_FORMAT = "data_type" 35 | P_TIMESTAMP = "timestamp" 36 | P_SIGN = "sign" 37 | P_SIGN_METHOD = "sign_method" 38 | P_PARTNER_ID = "partner_id" 39 | 40 | P_CODE = 'code' 41 | P_SUB_CODE = 'sub_code' 42 | P_MSG = 'msg' 43 | P_SUB_MSG = 'sub_msg' 44 | 45 | N_REST = '/api/router' 46 | 47 | 48 | def sign(secret, parameters): 49 | # =========================================================================== 50 | # '''签名方法 51 | # @param secret: 签名需要的密钥 52 | # @param parameters: 支持字典和string两种 53 | # ''' 54 | # =========================================================================== 55 | # 如果parameters 是字典类的话 56 | if hasattr(parameters, "items"): 57 | keys = parameters.keys() 58 | # keys.sort() 59 | keys = sorted(keys) 60 | 61 | parameters = "%s%s%s" % (secret, 62 | str().join('%s%s' % (key, parameters[key]) for key in keys), 63 | secret) 64 | sign = hashlib.md5(parameters.encode('utf-8')).hexdigest().upper() 65 | return sign 66 | 67 | 68 | def mixStr(pstr): 69 | if (isinstance(pstr, str)): 70 | return pstr 71 | # elif(isinstance(pstr, unicode)): 72 | elif (isinstance(pstr, bytes)): 73 | # return pstr.encode('utf-8') 74 | return pstr.decode('utf-8') 75 | else: 76 | return str(pstr) 77 | 78 | 79 | class FileItem(object): 80 | def __init__(self, filename=None, content=None): 81 | self.filename = filename 82 | self.content = content 83 | 84 | 85 | class MultiPartForm(object): 86 | """Accumulate the data to be used when posting a form.""" 87 | 88 | def __init__(self): 89 | self.form_fields = [] 90 | self.files = [] 91 | self.boundary = "PYTHON_SDK_BOUNDARY" 92 | return 93 | 94 | def get_content_type(self): 95 | return 'multipart/form-data; boundary=%s' % self.boundary 96 | 97 | def add_field(self, name, value): 98 | """Add a simple field to the form data.""" 99 | self.form_fields.append((name, str(value))) 100 | return 101 | 102 | def add_file(self, fieldname, filename, fileHandle, mimetype=None): 103 | """Add a file to be uploaded.""" 104 | body = fileHandle.read() 105 | if mimetype is None: 106 | mimetype = mimetypes.guess_type(filename)[0] or 'application/octet-stream' 107 | self.files.append((mixStr(fieldname), mixStr(filename), mixStr(mimetype), mixStr(body))) 108 | return 109 | 110 | def __str__(self): 111 | """Return a string representing the form data, including attached files.""" 112 | # Build a list of lists, each containing "lines" of the 113 | # request. Each part is separated by a boundary string. 114 | # Once the list is built, return a string where each 115 | # line is separated by '\r\n'. 116 | parts = [] 117 | part_boundary = '--' + self.boundary 118 | 119 | # Add the form fields 120 | parts.extend( 121 | [part_boundary, 122 | 'Content-Disposition: form-data; name="%s"' % name, 123 | 'Content-Type: text/plain; charset=UTF-8', 124 | '', 125 | value, 126 | ] 127 | for name, value in self.form_fields 128 | ) 129 | 130 | # Add the files to upload 131 | parts.extend( 132 | [part_boundary, 133 | 'Content-Disposition: file; name="%s"; filename="%s"' % \ 134 | (field_name, filename), 135 | 'Content-Type: %s' % content_type, 136 | 'Content-Transfer-Encoding: binary', 137 | '', 138 | body, 139 | ] 140 | for field_name, filename, content_type, body in self.files 141 | ) 142 | 143 | # Flatten the list and add closing boundary marker, 144 | # then return CR+LF separated data 145 | flattened = list(itertools.chain(*parts)) 146 | flattened.append('--' + self.boundary + '--') 147 | flattened.append('') 148 | return '\r\n'.join(flattened) 149 | 150 | 151 | class DdkException(Exception): 152 | # =========================================================================== 153 | # 业务异常类 154 | # =========================================================================== 155 | def __init__(self): 156 | self.errorcode = None 157 | self.message = None 158 | self.subcode = None 159 | self.submsg = None 160 | self.application_host = None 161 | self.service_host = None 162 | 163 | def __str__(self, *args, **kwargs): 164 | sb = "errorcode=" + mixStr(self.errorcode) + \ 165 | " message=" + mixStr(self.message) + \ 166 | " subcode=" + mixStr(self.subcode) + \ 167 | " submsg=" + mixStr(self.submsg) + \ 168 | " application_host=" + mixStr(self.application_host) + \ 169 | " service_host=" + mixStr(self.service_host) 170 | return sb 171 | 172 | 173 | class RequestException(Exception): 174 | # =========================================================================== 175 | # 请求连接异常类 176 | # =========================================================================== 177 | pass 178 | 179 | 180 | class RestApi(object): 181 | # =========================================================================== 182 | # Rest api的基类 183 | # =========================================================================== 184 | 185 | def __init__(self, domain='gw-api.pinduoduo.com', port=80): 186 | # ======================================================================= 187 | # 初始化基类 188 | # Args @param domain: 请求的域名或者ip 189 | # @param port: 请求的端口 190 | # ======================================================================= 191 | self.__domain = domain 192 | self.__port = port 193 | self.__httpmethod = "POST" 194 | if (ddk.getDefaultAppInfo()): 195 | self.__app_key = ddk.getDefaultAppInfo().appkey 196 | self.__secret = ddk.getDefaultAppInfo().secret 197 | 198 | def get_request_header(self): 199 | return { 200 | 'Content-type': 'application/x-www-form-urlencoded;charset=UTF-8', 201 | "Cache-Control": "no-cache", 202 | "Connection": "Keep-Alive", 203 | } 204 | 205 | def set_app_info(self, appinfo): 206 | # ======================================================================= 207 | # 设置请求的app信息 208 | # @param appinfo: import ddk 209 | # appinfo ddk.appinfo(appkey,secret) 210 | # ======================================================================= 211 | self.__app_key = appinfo.appkey 212 | self.__secret = appinfo.secret 213 | 214 | def getapiname(self): 215 | return "" 216 | 217 | def getMultipartParas(self): 218 | return []; 219 | 220 | def getTranslateParas(self): 221 | return {}; 222 | 223 | def _check_requst(self): 224 | pass 225 | 226 | def getResponse(self, authrize=None, timeout=30): 227 | # ======================================================================= 228 | # 获取response结果 229 | # ======================================================================= 230 | connection = httplib.HTTPConnection(self.__domain, self.__port, timeout) 231 | # sys_parameters = { 232 | # P_FORMAT: 'json', 233 | # P_APPKEY: self.__app_key, 234 | # P_SIGN_METHOD: "md5", 235 | # P_VERSION: '2.0', 236 | # P_TIMESTAMP: str(int(time.time())), 237 | # P_PARTNER_ID: SYSTEM_GENERATE_VERSION, 238 | # P_API: self.getapiname(), 239 | # } 240 | sys_parameters = { 241 | P_FORMAT: 'JSON', 242 | P_APPKEY: self.__app_key, 243 | # P_SIGN_METHOD: "md5", 244 | P_VERSION: 'V1', 245 | P_TIMESTAMP: str(int(time.time())),#UNIX时间戳,单位秒,需要与拼多多服务器时间差值在10分钟内 246 | # P_PARTNER_ID: SYSTEM_GENERATE_VERSION, 247 | P_API: self.getapiname(), 248 | } 249 | 250 | if authrize is not None: 251 | sys_parameters[P_SESSION] = authrize 252 | application_parameter = self.getApplicationParameters() 253 | sign_parameter = sys_parameters.copy() 254 | sign_parameter.update(application_parameter) 255 | # 256 | sys_parameters[P_SIGN] = sign(self.__secret, sign_parameter) 257 | connection.connect() 258 | 259 | header = self.get_request_header() 260 | if (self.getMultipartParas()): 261 | form = MultiPartForm() 262 | for key, value in application_parameter.items(): 263 | form.add_field(key, value) 264 | for key in self.getMultipartParas(): 265 | fileitem = getattr(self, key) 266 | if (fileitem and isinstance(fileitem, FileItem)): 267 | form.add_file(key, fileitem.filename, fileitem.content) 268 | body = str(form) 269 | header['Content-type'] = form.get_content_type() 270 | else: 271 | body = urllib.parse.urlencode(application_parameter) 272 | 273 | url = N_REST + "?" + urllib.parse.urlencode(sys_parameters) 274 | connection.request(self.__httpmethod, url, body=body, headers=header) 275 | response = connection.getresponse() 276 | # print(body,url)#验证 277 | 278 | if response.status is not 200: 279 | raise RequestException('invalid http status ' + str(response.status) + ',detail body:' + response.read()) 280 | result = response.read() 281 | jsonobj = json.loads(result) 282 | # print(jsonobj)#测试 283 | 284 | # if jsonobj.has_key("error_response"): 285 | if "error_response" in jsonobj: 286 | error = DdkException() 287 | # if jsonobj["error_response"].has_key(P_CODE) : 288 | if P_CODE in jsonobj["error_response"]: 289 | error.errorcode = jsonobj["error_response"][P_CODE] 290 | # if jsonobj["error_response"].has_key(P_MSG) : 291 | if P_MSG in jsonobj["error_response"]: 292 | error.message = jsonobj["error_response"][P_MSG] 293 | # if jsonobj["error_response"].has_key(P_SUB_CODE) : 294 | if P_SUB_CODE in jsonobj["error_response"]: 295 | error.subcode = jsonobj["error_response"][P_SUB_CODE] 296 | # if jsonobj["error_response"].has_key(P_SUB_MSG) : 297 | if P_SUB_MSG in jsonobj["error_response"]: 298 | error.submsg = jsonobj["error_response"][P_SUB_MSG] 299 | 300 | error.application_host = response.getheader("Application-Host", "") 301 | error.service_host = response.getheader("Location-Host", "") 302 | raise error 303 | return jsonobj 304 | 305 | def getApplicationParameters(self): 306 | application_parameter = {} 307 | for key, value in self.__dict__.items(): 308 | if not key.startswith("__") and not key in self.getMultipartParas() and not key.startswith("_RestApi__") and value is not None: 309 | if (key.startswith("_")): 310 | application_parameter[key[1:]] = value 311 | else: 312 | application_parameter[key] = value 313 | # 查询翻译字典来规避一些关键字属性 314 | translate_parameter = self.getTranslateParas() 315 | for key, value in application_parameter.items(): 316 | if key in translate_parameter: 317 | application_parameter[translate_parameter[key]] = application_parameter[key] 318 | del application_parameter[key] 319 | return application_parameter 320 | -------------------------------------------------------------------------------- /测试/获取拼多多标准商品类目信息1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 16:02 3 | # @Author : play4fun 4 | # @File : 获取拼多多标准商品类目信息1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 获取拼多多标准商品类目信息1.py: 9 | 10 | GoodsCatsGet 11 | """ 12 | 13 | from ddk.api.rest.GoodsCatsGet import GoodsCatsGet 14 | from ddk import appinfo 15 | import traceback, json 16 | from config import pdd_client_id, pdd_client_secret 17 | 18 | 19 | def test1(): 20 | req = GoodsCatsGet() 21 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 22 | # 23 | req.parent_cat_id = 5851#电脑 #259#"饰品首饰" 24 | 25 | try: 26 | resp = req.getResponse() 27 | print(resp) 28 | print('-' * 40) 29 | print(json.dumps(resp)) 30 | 31 | # print(json.dumps(f, ensure_ascii=False)) 32 | except Exception as e: 33 | print(e) 34 | print(traceback.format_exc()) 35 | ''' 36 | { 37 | "goods_cats_get_response": { 38 | "goods_cats_list": [ 39 | { 40 | "level": 1, 41 | "cat_name": "美容护肤/精油", 42 | "cat_id": 69, 43 | "parent_cat_id": 0 44 | }, 45 | { 46 | "level": 1, 47 | "cat_name": "男装", 48 | "cat_id": 239, 49 | "parent_cat_id": 0 50 | }, 51 | { 52 | "level": 1, 53 | "cat_name": "饰品首饰", 54 | "cat_id": 259, 55 | "parent_cat_id": 0 56 | }, 57 | { 58 | "level": 1, 59 | "cat_name": "厨房用品", 60 | "cat_id": 282, 61 | "parent_cat_id": 0 62 | }, 63 | { 64 | "level": 1, 65 | "cat_name": "家庭清洁", 66 | "cat_id": 479, 67 | "parent_cat_id": 0 68 | }, 69 | { 70 | "level": 1, 71 | "cat_name": "洗护纸品", 72 | "cat_id": 483, 73 | "parent_cat_id": 0 74 | }, 75 | { 76 | "level": 1, 77 | "cat_name": "居家日用", 78 | "cat_id": 489, 79 | "parent_cat_id": 0 80 | }, 81 | { 82 | "level": 1, 83 | "cat_name": "收纳整理", 84 | "cat_id": 519, 85 | "parent_cat_id": 0 86 | }, 87 | { 88 | "level": 1, 89 | "cat_name": "宠物用品", 90 | "cat_id": 525, 91 | "parent_cat_id": 0 92 | }, 93 | { 94 | "level": 1, 95 | "cat_name": "珠宝黄金", 96 | "cat_id": 1166, 97 | "parent_cat_id": 0 98 | }, 99 | { 100 | "level": 1, 101 | "cat_name": "个护美体", 102 | "cat_id": 1432, 103 | "parent_cat_id": 0 104 | }, 105 | { 106 | "level": 1, 107 | "cat_name": "彩妆/香水/美妆工具", 108 | "cat_id": 1464, 109 | "parent_cat_id": 0 110 | }, 111 | { 112 | "level": 1, 113 | "cat_name": "成人用品", 114 | "cat_id": 1715, 115 | "parent_cat_id": 0 116 | }, 117 | { 118 | "level": 1, 119 | "cat_name": "鲜花园艺", 120 | "cat_id": 1889, 121 | "parent_cat_id": 0 122 | }, 123 | { 124 | "level": 1, 125 | "cat_name": "办公用品", 126 | "cat_id": 2603, 127 | "parent_cat_id": 0 128 | }, 129 | { 130 | "level": 1, 131 | "cat_name": "文化用品", 132 | "cat_id": 2629, 133 | "parent_cat_id": 0 134 | }, 135 | { 136 | "level": 1, 137 | "cat_name": "3C数码配件", 138 | "cat_id": 2933, 139 | "parent_cat_id": 0 140 | }, 141 | { 142 | "level": 1, 143 | "cat_name": "书籍杂志", 144 | "cat_id": 3202, 145 | "parent_cat_id": 0 146 | }, 147 | { 148 | "level": 1, 149 | "cat_name": "乐器/吉他/钢琴/配件", 150 | "cat_id": 4958, 151 | "parent_cat_id": 0 152 | }, 153 | { 154 | "level": 1, 155 | "cat_name": "影音电器", 156 | "cat_id": 5752, 157 | "parent_cat_id": 0 158 | }, 159 | { 160 | "level": 1, 161 | "cat_name": "手机", 162 | "cat_id": 5834, 163 | "parent_cat_id": 0 164 | }, 165 | { 166 | "level": 1, 167 | "cat_name": "二手数码", 168 | "cat_id": 5839, 169 | "parent_cat_id": 0 170 | }, 171 | { 172 | "level": 1, 173 | "cat_name": "电脑", 174 | "cat_id": 5851, 175 | "parent_cat_id": 0 176 | }, 177 | { 178 | "level": 1, 179 | "cat_name": "数码相机/单反相机/摄像机", 180 | "cat_id": 5906, 181 | "parent_cat_id": 0 182 | }, 183 | { 184 | "level": 1, 185 | "cat_name": "智能设备", 186 | "cat_id": 5921, 187 | "parent_cat_id": 0 188 | }, 189 | { 190 | "level": 1, 191 | "cat_name": "厨房电器", 192 | "cat_id": 5955, 193 | "parent_cat_id": 0 194 | }, 195 | { 196 | "level": 1, 197 | "cat_name": "大家电", 198 | "cat_id": 6076, 199 | "parent_cat_id": 0 200 | }, 201 | { 202 | "level": 1, 203 | "cat_name": "生活电器", 204 | "cat_id": 6128, 205 | "parent_cat_id": 0 206 | }, 207 | { 208 | "level": 1, 209 | "cat_name": "个人护理保健", 210 | "cat_id": 6209, 211 | "parent_cat_id": 0 212 | }, 213 | { 214 | "level": 1, 215 | "cat_name": "网络设备", 216 | "cat_id": 6290, 217 | "parent_cat_id": 0 218 | }, 219 | { 220 | "level": 1, 221 | "cat_name": "零食/坚果/特产", 222 | "cat_id": 6398, 223 | "parent_cat_id": 0 224 | }, 225 | { 226 | "level": 1, 227 | "cat_name": "咖啡/麦片/冲饮", 228 | "cat_id": 6536, 229 | "parent_cat_id": 0 230 | }, 231 | { 232 | "level": 1, 233 | "cat_name": "茶", 234 | "cat_id": 6586, 235 | "parent_cat_id": 0 236 | }, 237 | { 238 | "level": 1, 239 | "cat_name": "粮油米面/南北干货/调味品", 240 | "cat_id": 6630, 241 | "parent_cat_id": 0 242 | }, 243 | { 244 | "level": 1, 245 | "cat_name": "酒类", 246 | "cat_id": 6758, 247 | "parent_cat_id": 0 248 | }, 249 | { 250 | "level": 1, 251 | "cat_name": "保健食品/膳食营养补充食品", 252 | "cat_id": 6785, 253 | "parent_cat_id": 0 254 | }, 255 | { 256 | "level": 1, 257 | "cat_name": "传统滋补品", 258 | "cat_id": 6883, 259 | "parent_cat_id": 0 260 | }, 261 | { 262 | "level": 1, 263 | "cat_name": "电子元器件市场", 264 | "cat_id": 7323, 265 | "parent_cat_id": 0 266 | }, 267 | { 268 | "level": 1, 269 | "cat_name": "摩托车/装备/配件", 270 | "cat_id": 7629, 271 | "parent_cat_id": 0 272 | }, 273 | { 274 | "level": 1, 275 | "cat_name": "汽车/用品/配件/改装", 276 | "cat_id": 7639, 277 | "parent_cat_id": 0 278 | }, 279 | { 280 | "level": 1, 281 | "cat_name": "水产肉类/新鲜蔬果/熟食", 282 | "cat_id": 8172, 283 | "parent_cat_id": 0 284 | }, 285 | { 286 | "level": 1, 287 | "cat_name": "女装/女士精品", 288 | "cat_id": 8439, 289 | "parent_cat_id": 0 290 | }, 291 | { 292 | "level": 1, 293 | "cat_name": "新车/二手车", 294 | "cat_id": 8502, 295 | "parent_cat_id": 0 296 | }, 297 | { 298 | "level": 1, 299 | "cat_name": "流行男鞋", 300 | "cat_id": 8508, 301 | "parent_cat_id": 0 302 | }, 303 | { 304 | "level": 1, 305 | "cat_name": "女鞋", 306 | "cat_id": 8509, 307 | "parent_cat_id": 0 308 | }, 309 | { 310 | "level": 1, 311 | "cat_name": "箱包皮具/女包/男包", 312 | "cat_id": 8538, 313 | "parent_cat_id": 0 314 | }, 315 | { 316 | "level": 1, 317 | "cat_name": "内衣裤袜", 318 | "cat_id": 8583, 319 | "parent_cat_id": 0 320 | }, 321 | { 322 | "level": 1, 323 | "cat_name": "腕表眼镜", 324 | "cat_id": 8634, 325 | "parent_cat_id": 0 326 | }, 327 | { 328 | "level": 1, 329 | "cat_name": "服饰配件", 330 | "cat_id": 8669, 331 | "parent_cat_id": 0 332 | }, 333 | { 334 | "level": 1, 335 | "cat_name": "本地化生活服务", 336 | "cat_id": 8721, 337 | "parent_cat_id": 0 338 | }, 339 | { 340 | "level": 1, 341 | "cat_name": "电影/演出/体育赛事", 342 | "cat_id": 8722, 343 | "parent_cat_id": 0 344 | }, 345 | { 346 | "level": 1, 347 | "cat_name": "个性定制/设计服务", 348 | "cat_id": 8723, 349 | "parent_cat_id": 0 350 | }, 351 | { 352 | "level": 1, 353 | "cat_name": "购物卡/礼品卡/代金券", 354 | "cat_id": 8724, 355 | "parent_cat_id": 0 356 | }, 357 | { 358 | "level": 1, 359 | "cat_name": "婚庆/摄影/摄像服务", 360 | "cat_id": 8725, 361 | "parent_cat_id": 0 362 | }, 363 | { 364 | "level": 1, 365 | "cat_name": "教育培训", 366 | "cat_id": 8726, 367 | "parent_cat_id": 0 368 | }, 369 | { 370 | "level": 1, 371 | "cat_name": "景点门票/周边游", 372 | "cat_id": 8727, 373 | "parent_cat_id": 0 374 | }, 375 | { 376 | "level": 1, 377 | "cat_name": "旅游路线/商品/服务", 378 | "cat_id": 8728, 379 | "parent_cat_id": 0 380 | }, 381 | { 382 | "level": 1, 383 | "cat_name": "生活缴费", 384 | "cat_id": 8729, 385 | "parent_cat_id": 0 386 | }, 387 | { 388 | "level": 1, 389 | "cat_name": "影视/会员/腾讯QQ专区", 390 | "cat_id": 8730, 391 | "parent_cat_id": 0 392 | }, 393 | { 394 | "level": 1, 395 | "cat_name": "网络服务/软件", 396 | "cat_id": 8732, 397 | "parent_cat_id": 0 398 | }, 399 | { 400 | "level": 1, 401 | "cat_name": "网上营业厅", 402 | "cat_id": 8733, 403 | "parent_cat_id": 0 404 | }, 405 | { 406 | "level": 1, 407 | "cat_name": "休闲娱乐", 408 | "cat_id": 8734, 409 | "parent_cat_id": 0 410 | }, 411 | { 412 | "level": 1, 413 | "cat_name": "游戏服务/直播", 414 | "cat_id": 8736, 415 | "parent_cat_id": 0 416 | }, 417 | { 418 | "level": 1, 419 | "cat_name": "床上用品", 420 | "cat_id": 9313, 421 | "parent_cat_id": 0 422 | }, 423 | { 424 | "level": 1, 425 | "cat_name": "电子/电工", 426 | "cat_id": 9314, 427 | "parent_cat_id": 0 428 | }, 429 | { 430 | "level": 1, 431 | "cat_name": "基础建材", 432 | "cat_id": 9315, 433 | "parent_cat_id": 0 434 | }, 435 | { 436 | "level": 1, 437 | "cat_name": "家居饰品", 438 | "cat_id": 9316, 439 | "parent_cat_id": 0 440 | }, 441 | { 442 | "level": 1, 443 | "cat_name": "家装灯饰光源", 444 | "cat_id": 9317, 445 | "parent_cat_id": 0 446 | }, 447 | { 448 | "level": 1, 449 | "cat_name": "家装主材", 450 | "cat_id": 9318, 451 | "parent_cat_id": 0 452 | }, 453 | { 454 | "level": 1, 455 | "cat_name": "居家布艺", 456 | "cat_id": 9319, 457 | "parent_cat_id": 0 458 | }, 459 | { 460 | "level": 1, 461 | "cat_name": "全屋定制", 462 | "cat_id": 9320, 463 | "parent_cat_id": 0 464 | }, 465 | { 466 | "level": 1, 467 | "cat_name": "商业/办公家具", 468 | "cat_id": 9321, 469 | "parent_cat_id": 0 470 | }, 471 | { 472 | "level": 1, 473 | "cat_name": "特色手工艺", 474 | "cat_id": 9322, 475 | "parent_cat_id": 0 476 | }, 477 | { 478 | "level": 1, 479 | "cat_name": "五金工具", 480 | "cat_id": 9323, 481 | "parent_cat_id": 0 482 | }, 483 | { 484 | "level": 1, 485 | "cat_name": "住宅家具", 486 | "cat_id": 9324, 487 | "parent_cat_id": 0 488 | }, 489 | { 490 | "level": 1, 491 | "cat_name": "电动车/配件/交通工具", 492 | "cat_id": 11683, 493 | "parent_cat_id": 0 494 | }, 495 | { 496 | "level": 1, 497 | "cat_name": "户外/登山/旅行野营用品", 498 | "cat_id": 11684, 499 | "parent_cat_id": 0 500 | }, 501 | { 502 | "level": 1, 503 | "cat_name": "运动/瑜伽/健身/球类", 504 | "cat_id": 11685, 505 | "parent_cat_id": 0 506 | }, 507 | { 508 | "level": 1, 509 | "cat_name": "运动包/户外包/配件", 510 | "cat_id": 11686, 511 | "parent_cat_id": 0 512 | }, 513 | { 514 | "level": 1, 515 | "cat_name": "运动服/休闲服", 516 | "cat_id": 11687, 517 | "parent_cat_id": 0 518 | }, 519 | { 520 | "level": 1, 521 | "cat_name": "运动鞋", 522 | "cat_id": 11688, 523 | "parent_cat_id": 0 524 | }, 525 | { 526 | "level": 1, 527 | "cat_name": "自行车/骑行装备/零配件", 528 | "cat_id": 11689, 529 | "parent_cat_id": 0 530 | }, 531 | { 532 | "level": 1, 533 | "cat_name": "OTC药品/医疗器械/计生用品", 534 | "cat_id": 13176, 535 | "parent_cat_id": 0 536 | }, 537 | { 538 | "level": 1, 539 | "cat_name": "精制中药材", 540 | "cat_id": 13177, 541 | "parent_cat_id": 0 542 | }, 543 | { 544 | "level": 1, 545 | "cat_name": "隐形眼镜/护理液", 546 | "cat_id": 13178, 547 | "parent_cat_id": 0 548 | }, 549 | { 550 | "level": 1, 551 | "cat_name": "奶粉/辅食/营养品/零食", 552 | "cat_id": 14697, 553 | "parent_cat_id": 0 554 | }, 555 | { 556 | "level": 1, 557 | "cat_name": "尿片/洗护/喂哺/推车床", 558 | "cat_id": 14740, 559 | "parent_cat_id": 0 560 | }, 561 | { 562 | "level": 1, 563 | "cat_name": "童鞋/婴儿鞋/亲子鞋", 564 | "cat_id": 14933, 565 | "parent_cat_id": 0 566 | }, 567 | { 568 | "level": 1, 569 | "cat_name": "童装/婴儿装/亲子装", 570 | "cat_id": 14966, 571 | "parent_cat_id": 0 572 | }, 573 | { 574 | "level": 1, 575 | "cat_name": "玩具/童车/益智/积木/模型", 576 | "cat_id": 15083, 577 | "parent_cat_id": 0 578 | }, 579 | { 580 | "level": 1, 581 | "cat_name": "孕产妇用品/孕妇装/营养", 582 | "cat_id": 15356, 583 | "parent_cat_id": 0 584 | }, 585 | { 586 | "level": 1, 587 | "cat_name": "书籍/杂志/报纸", 588 | "cat_id": 15543, 589 | "parent_cat_id": 0 590 | }, 591 | { 592 | "level": 1, 593 | "cat_name": "农机/农具/农膜", 594 | "cat_id": 16155, 595 | "parent_cat_id": 0 596 | }, 597 | { 598 | "level": 1, 599 | "cat_name": "畜牧/养殖物资", 600 | "cat_id": 16192, 601 | "parent_cat_id": 0 602 | }, 603 | { 604 | "level": 1, 605 | "cat_name": "农用物资", 606 | "cat_id": 16209, 607 | "parent_cat_id": 0 608 | }, 609 | { 610 | "level": 1, 611 | "cat_name": "成人用品/情趣用品", 612 | "cat_id": 16237, 613 | "parent_cat_id": 0 614 | }, 615 | { 616 | "level": 1, 617 | "cat_name": "宠物/宠物食品及用品", 618 | "cat_id": 16288, 619 | "parent_cat_id": 0 620 | }, 621 | { 622 | "level": 1, 623 | "cat_name": "餐饮具", 624 | "cat_id": 16548, 625 | "parent_cat_id": 0 626 | }, 627 | { 628 | "level": 1, 629 | "cat_name": "厨房/烹饪用具", 630 | "cat_id": 16676, 631 | "parent_cat_id": 0 632 | }, 633 | { 634 | "level": 1, 635 | "cat_name": "收纳整理", 636 | "cat_id": 16794, 637 | "parent_cat_id": 0 638 | }, 639 | { 640 | "level": 1, 641 | "cat_name": "家庭/个人清洁工具", 642 | "cat_id": 16901, 643 | "parent_cat_id": 0 644 | }, 645 | { 646 | "level": 1, 647 | "cat_name": "居家日用", 648 | "cat_id": 16989, 649 | "parent_cat_id": 0 650 | }, 651 | { 652 | "level": 1, 653 | "cat_name": "节庆用品/礼品", 654 | "cat_id": 17134, 655 | "parent_cat_id": 0 656 | }, 657 | { 658 | "level": 1, 659 | "cat_name": "烟品/打火机/瑞士军刀", 660 | "cat_id": 17249, 661 | "parent_cat_id": 0 662 | }, 663 | { 664 | "level": 1, 665 | "cat_name": "洗护清洁剂/卫生巾/纸/香薰", 666 | "cat_id": 17285, 667 | "parent_cat_id": 0 668 | }, 669 | { 670 | "level": 1, 671 | "cat_name": "饰品/流行首饰/时尚饰品", 672 | "cat_id": 17412, 673 | "parent_cat_id": 0 674 | }, 675 | { 676 | "level": 1, 677 | "cat_name": "珠宝/钻石/翡翠/黄金", 678 | "cat_id": 17455, 679 | "parent_cat_id": 0 680 | }, 681 | { 682 | "level": 1, 683 | "cat_name": "鲜花速递/花卉仿真/绿植园艺", 684 | "cat_id": 17671, 685 | "parent_cat_id": 0 686 | }, 687 | { 688 | "level": 1, 689 | "cat_name": "乐器/吉他/钢琴/配件", 690 | "cat_id": 17803, 691 | "parent_cat_id": 0 692 | }, 693 | { 694 | "level": 1, 695 | "cat_name": "装修设计/施工/监理", 696 | "cat_id": 18088, 697 | "parent_cat_id": 0 698 | } 699 | ], 700 | "request_id": "15451203761173134" 701 | } 702 | } 703 | ''' 704 | 705 | 706 | if __name__ == '__main__': 707 | test1() 708 | -------------------------------------------------------------------------------- /测试/下线/查询店铺商品1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 16:53 3 | # @Author : play4fun 4 | # @File : 查询店铺商品1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 查询店铺商品1.py: 9 | 2021 10 | 当前接口已下线 11 | 12 | pdd.ddk.mall.goods.list.get 13 | DdkMallGoodsListGet 14 | 15 | """ 16 | 17 | 18 | from ddk.api.rest.DdkMallGoodsListGet import DdkMallGoodsListGet 19 | from ddk import appinfo 20 | import traceback,json 21 | from config import pdd_client_id,pdd_client_secret 22 | 23 | def test1(): 24 | req = DdkMallGoodsListGet() 25 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 26 | # 27 | req.mall_id = 327071922 28 | req.page_number = 1 29 | req.page_size = 10 30 | try: 31 | resp = req.getResponse() 32 | print(resp) 33 | print('-' * 40) 34 | print(json.dumps(resp)) 35 | 36 | # print(json.dumps(f, ensure_ascii=False)) 37 | except Exception as e: 38 | print(e) 39 | print(traceback.format_exc()) 40 | ''' 41 | { 42 | "goods_info_list_response": { 43 | "total": 0, 44 | "goods_list": [ 45 | { 46 | "category_name": "手机", 47 | "coupon_remain_quantity": null, 48 | "serv_pct": null, 49 | "promotion_rate": 10, 50 | "coupon_id": null, 51 | "lock_edit": null, 52 | "mall_id": 327071922, 53 | "share_desc": null, 54 | "mall_name": "白羽家", 55 | "coupon_price": 0, 56 | "rank": null, 57 | "desc_pct": null, 58 | "market_fee": 12, 59 | "goods_name": "磁吸数据线铝合金苹果安卓手机线快充磁力磁性充电线磁吸磁铁通用", 60 | "goods_eval_count": 0, 61 | "goods_id": 2205862698, 62 | "goods_gallery_urls": null, 63 | "goods_desc": null, 64 | "opt_name": "手机", 65 | "opt_ids": [ 66 | 3138, 67 | 1555, 68 | 1543, 69 | 3146, 70 | 1546, 71 | 12, 72 | 3132, 73 | 1246, 74 | 223 75 | ], 76 | "goods_image_url": "http://t00img.yangkeduo.com/t11img/images/2018-07-20/c51d7e6d7ea88b5040159ad99dcb5ad5.jpeg", 77 | "is_valid": true, 78 | "min_group_price": 1250, 79 | "coupon_start_time": null, 80 | "coupon_discount": 0, 81 | "coupon_end_time": null, 82 | "avg_desc": null, 83 | "avg_serv": null, 84 | "avg_lgst": null, 85 | "sold_quantity": 24748, 86 | "cat_ids": null, 87 | "coupon_min_order_amount": 0, 88 | "goods_fact_price": 1250, 89 | "lgst_pct": null, 90 | "category_id": 1543, 91 | "goods_eval_score": 0, 92 | "cat_id": null, 93 | "coupon_total_quantity": null, 94 | "goods_rate": 10, 95 | "merchant_type": 1, 96 | "goods_mark_price": 2600, 97 | "qr_code_image_url": null, 98 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/t02img/images/2018-07-14/9c231bba2c026435bae0cbeddd0f3100.jpeg", 99 | "broker": null, 100 | "opt_id": 1543, 101 | "sale_num_today": null, 102 | "sale_num24": 31, 103 | "min_normal_price": 1400, 104 | "has_coupon": false, 105 | "goods_mall_coupon_price": null, 106 | "mall_rate": 10, 107 | "goods_type": 1, 108 | "create_at": null, 109 | "mall_cps": 1 110 | }, 111 | { 112 | "category_name": "手机", 113 | "coupon_remain_quantity": 100, 114 | "serv_pct": null, 115 | "promotion_rate": 10, 116 | "coupon_id": 370854822, 117 | "lock_edit": null, 118 | "mall_id": 327071922, 119 | "share_desc": null, 120 | "mall_name": "白羽家", 121 | "coupon_price": 300, 122 | "rank": null, 123 | "desc_pct": null, 124 | "market_fee": 44, 125 | "goods_name": "USB灯移动电源USB小夜灯床头台灯宿舍灯护眼USB灯", 126 | "goods_eval_count": 0, 127 | "goods_id": 4979630814, 128 | "goods_gallery_urls": null, 129 | "goods_desc": null, 130 | "opt_name": "手机", 131 | "opt_ids": [ 132 | 3362, 133 | 2483, 134 | 3364, 135 | 2517, 136 | 1543, 137 | 1559, 138 | 1546, 139 | 12, 140 | 3149, 141 | 1246, 142 | 2478, 143 | 223 144 | ], 145 | "goods_image_url": "http://t00img.yangkeduo.com/goods/images/2018-12-16/690c972321f07917f9482bcb365249fa.jpeg", 146 | "is_valid": true, 147 | "min_group_price": 449, 148 | "coupon_start_time": 1545062400, 149 | "coupon_discount": 300, 150 | "coupon_end_time": 1545235199, 151 | "avg_desc": null, 152 | "avg_serv": null, 153 | "avg_lgst": null, 154 | "sold_quantity": 2071, 155 | "cat_ids": null, 156 | "coupon_min_order_amount": 300, 157 | "goods_fact_price": 449, 158 | "lgst_pct": null, 159 | "category_id": 1543, 160 | "goods_eval_score": 0, 161 | "cat_id": null, 162 | "coupon_total_quantity": 1000, 163 | "goods_rate": 10, 164 | "merchant_type": 1, 165 | "goods_mark_price": 5400, 166 | "qr_code_image_url": null, 167 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-12-16/d11c3627319f49c7876dc31418243dcf.jpeg", 168 | "broker": null, 169 | "opt_id": 1543, 170 | "sale_num_today": null, 171 | "sale_num24": 950, 172 | "min_normal_price": 549, 173 | "has_coupon": true, 174 | "goods_mall_coupon_price": null, 175 | "mall_rate": 10, 176 | "goods_type": 1, 177 | "create_at": null, 178 | "mall_cps": 1 179 | }, 180 | { 181 | "category_name": "手机", 182 | "coupon_remain_quantity": 50, 183 | "serv_pct": null, 184 | "promotion_rate": 10, 185 | "coupon_id": 369720612, 186 | "lock_edit": null, 187 | "mall_id": 327071922, 188 | "share_desc": null, 189 | "mall_name": "白羽家", 190 | "coupon_price": 300, 191 | "rank": null, 192 | "desc_pct": null, 193 | "market_fee": 59, 194 | "goods_name": "充电线收纳盒充电器数据线收纳包u盘耳机线收纳盒", 195 | "goods_eval_count": 0, 196 | "goods_id": 4791600618, 197 | "goods_gallery_urls": null, 198 | "goods_desc": null, 199 | "opt_name": "手机", 200 | "opt_ids": [ 201 | 3362, 202 | 3363, 203 | 3364, 204 | 3365, 205 | 1543, 206 | 1545, 207 | 12, 208 | 3149, 209 | 2477, 210 | 1246, 211 | 223 212 | ], 213 | "goods_image_url": "", 214 | "is_valid": true, 215 | "min_group_price": 499, 216 | "coupon_start_time": 1544976000, 217 | "coupon_discount": 300, 218 | "coupon_end_time": 1545148799, 219 | "avg_desc": null, 220 | "avg_serv": null, 221 | "avg_lgst": null, 222 | "sold_quantity": 605, 223 | "cat_ids": null, 224 | "coupon_min_order_amount": 300, 225 | "goods_fact_price": 499, 226 | "lgst_pct": null, 227 | "category_id": 1543, 228 | "goods_eval_score": 0, 229 | "cat_id": null, 230 | "coupon_total_quantity": 1000, 231 | "goods_rate": 10, 232 | "merchant_type": 1, 233 | "goods_mark_price": 2500, 234 | "qr_code_image_url": null, 235 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-12-08/d006bbd5ea2509536bd2ca0b37f32f01.jpeg", 236 | "broker": null, 237 | "opt_id": 1543, 238 | "sale_num_today": null, 239 | "sale_num24": 125, 240 | "min_normal_price": 599, 241 | "has_coupon": true, 242 | "goods_mall_coupon_price": null, 243 | "mall_rate": 10, 244 | "goods_type": 1, 245 | "create_at": null, 246 | "mall_cps": 1 247 | }, 248 | { 249 | "category_name": "海淘", 250 | "coupon_remain_quantity": 50, 251 | "serv_pct": null, 252 | "promotion_rate": 10, 253 | "coupon_id": 368848962, 254 | "lock_edit": null, 255 | "mall_id": 327071922, 256 | "share_desc": null, 257 | "mall_name": "白羽家", 258 | "coupon_price": 300, 259 | "rank": null, 260 | "desc_pct": null, 261 | "market_fee": 81, 262 | "goods_name": "手机防水袋水下拍照触屏潜水游泳防水袋温泉防水袋通用款", 263 | "goods_eval_count": 0, 264 | "goods_id": 4810395645, 265 | "goods_gallery_urls": null, 266 | "goods_desc": null, 267 | "opt_name": "海淘", 268 | "opt_ids": [ 269 | 482, 270 | 277, 271 | 295, 272 | 12, 273 | 223, 274 | 15, 275 | 479 276 | ], 277 | "goods_image_url": "", 278 | "is_valid": true, 279 | "min_group_price": 570, 280 | "coupon_start_time": 1544976000, 281 | "coupon_discount": 300, 282 | "coupon_end_time": 1545148799, 283 | "avg_desc": null, 284 | "avg_serv": null, 285 | "avg_lgst": null, 286 | "sold_quantity": 376, 287 | "cat_ids": null, 288 | "coupon_min_order_amount": 300, 289 | "goods_fact_price": 570, 290 | "lgst_pct": null, 291 | "category_id": 12, 292 | "goods_eval_score": 0, 293 | "cat_id": null, 294 | "coupon_total_quantity": 1000, 295 | "goods_rate": 10, 296 | "merchant_type": 1, 297 | "goods_mark_price": 1999, 298 | "qr_code_image_url": null, 299 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-12-09/8db1c2671def8a2616bf05aad8653982.jpeg", 300 | "broker": null, 301 | "opt_id": 12, 302 | "sale_num_today": null, 303 | "sale_num24": 122, 304 | "min_normal_price": 670, 305 | "has_coupon": true, 306 | "goods_mall_coupon_price": null, 307 | "mall_rate": 10, 308 | "goods_type": 1, 309 | "create_at": null, 310 | "mall_cps": 1 311 | }, 312 | { 313 | "category_name": "手机", 314 | "coupon_remain_quantity": 50, 315 | "serv_pct": null, 316 | "promotion_rate": 10, 317 | "coupon_id": 367245382, 318 | "lock_edit": null, 319 | "mall_id": 327071922, 320 | "share_desc": null, 321 | "mall_name": "白羽家", 322 | "coupon_price": 100, 323 | "rank": null, 324 | "desc_pct": null, 325 | "market_fee": 379, 326 | "goods_name": "【19.99元抢200件,抢完恢复24.99元】磁吸数据线车载快充苹果oppo华为type-c安卓vivo充电器线手机通用", 327 | "goods_eval_count": 0, 328 | "goods_id": 3354254431, 329 | "goods_gallery_urls": null, 330 | "goods_desc": null, 331 | "opt_name": "手机", 332 | "opt_ids": [ 333 | 3138, 334 | 1555, 335 | 1543, 336 | 3146, 337 | 1546, 338 | 12, 339 | 3132, 340 | 1246, 341 | 223 342 | ], 343 | "goods_image_url": "http://t00img.yangkeduo.com/goods/images/2018-12-12/683ec30d8485f78aa30a014de3c681db.png", 344 | "is_valid": true, 345 | "min_group_price": 1999, 346 | "coupon_start_time": 1544889600, 347 | "coupon_discount": 100, 348 | "coupon_end_time": 1545148799, 349 | "avg_desc": null, 350 | "avg_serv": null, 351 | "avg_lgst": null, 352 | "sold_quantity": 311, 353 | "cat_ids": null, 354 | "coupon_min_order_amount": 100, 355 | "goods_fact_price": 1999, 356 | "lgst_pct": null, 357 | "category_id": 1543, 358 | "goods_eval_score": 0, 359 | "cat_id": null, 360 | "coupon_total_quantity": 100, 361 | "goods_rate": 10, 362 | "merchant_type": 1, 363 | "goods_mark_price": 3400, 364 | "qr_code_image_url": null, 365 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-10-15/708992dd75138dd210aee31f682dbac4.jpeg", 366 | "broker": null, 367 | "opt_id": 1543, 368 | "sale_num_today": null, 369 | "sale_num24": 0, 370 | "min_normal_price": 2600, 371 | "has_coupon": true, 372 | "goods_mall_coupon_price": null, 373 | "mall_rate": 10, 374 | "goods_type": 1, 375 | "create_at": null, 376 | "mall_cps": 1 377 | }, 378 | { 379 | "category_name": "手机", 380 | "coupon_remain_quantity": null, 381 | "serv_pct": null, 382 | "promotion_rate": 10, 383 | "coupon_id": null, 384 | "lock_edit": null, 385 | "mall_id": 327071922, 386 | "share_desc": null, 387 | "mall_name": "白羽家", 388 | "coupon_price": 0, 389 | "rank": null, 390 | "desc_pct": null, 391 | "market_fee": 7, 392 | "goods_name": "弯头数据线苹果67快充安卓Type-C铝合金充电线手机充电器线抖音款", 393 | "goods_eval_count": 0, 394 | "goods_id": 2190814663, 395 | "goods_gallery_urls": null, 396 | "goods_desc": null, 397 | "opt_name": "手机", 398 | "opt_ids": [ 399 | 3138, 400 | 1555, 401 | 1543, 402 | 3146, 403 | 1546, 404 | 12, 405 | 3132, 406 | 1246, 407 | 223 408 | ], 409 | "goods_image_url": "http://t00img.yangkeduo.com/t05img/images/2018-07-14/db025ef4bb19649e37038898c9a2ed13.jpeg", 410 | "is_valid": true, 411 | "min_group_price": 744, 412 | "coupon_start_time": null, 413 | "coupon_discount": 0, 414 | "coupon_end_time": null, 415 | "avg_desc": null, 416 | "avg_serv": null, 417 | "avg_lgst": null, 418 | "sold_quantity": 25, 419 | "cat_ids": null, 420 | "coupon_min_order_amount": 0, 421 | "goods_fact_price": 744, 422 | "lgst_pct": null, 423 | "category_id": 1543, 424 | "goods_eval_score": 0, 425 | "cat_id": null, 426 | "coupon_total_quantity": null, 427 | "goods_rate": 10, 428 | "merchant_type": 1, 429 | "goods_mark_price": 2000, 430 | "qr_code_image_url": null, 431 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/t01img/images/2018-07-14/7da751ee1a0be875fbde832e7afab69d.jpeg", 432 | "broker": null, 433 | "opt_id": 1543, 434 | "sale_num_today": null, 435 | "sale_num24": 0, 436 | "min_normal_price": 990, 437 | "has_coupon": false, 438 | "goods_mall_coupon_price": null, 439 | "mall_rate": 10, 440 | "goods_type": 1, 441 | "create_at": null, 442 | "mall_cps": 1 443 | }, 444 | { 445 | "category_name": "手机", 446 | "coupon_remain_quantity": null, 447 | "serv_pct": null, 448 | "promotion_rate": 10, 449 | "coupon_id": null, 450 | "lock_edit": null, 451 | "mall_id": 327071922, 452 | "share_desc": null, 453 | "mall_name": "白羽家", 454 | "coupon_price": 0, 455 | "rank": null, 456 | "desc_pct": null, 457 | "market_fee": 24, 458 | "goods_name": "弯头苹果数据线二合一快充安卓充电线耳机转接头7p/8p/x一体接口", 459 | "goods_eval_count": 0, 460 | "goods_id": 3293377900, 461 | "goods_gallery_urls": null, 462 | "goods_desc": null, 463 | "opt_name": "手机", 464 | "opt_ids": [ 465 | 3138, 466 | 1555, 467 | 1543, 468 | 3146, 469 | 1546, 470 | 12, 471 | 3132, 472 | 1246, 473 | 223 474 | ], 475 | "goods_image_url": "", 476 | "is_valid": true, 477 | "min_group_price": 2499, 478 | "coupon_start_time": null, 479 | "coupon_discount": 0, 480 | "coupon_end_time": null, 481 | "avg_desc": null, 482 | "avg_serv": null, 483 | "avg_lgst": null, 484 | "sold_quantity": 19, 485 | "cat_ids": null, 486 | "coupon_min_order_amount": 0, 487 | "goods_fact_price": 2499, 488 | "lgst_pct": null, 489 | "category_id": 1543, 490 | "goods_eval_score": 0, 491 | "cat_id": null, 492 | "coupon_total_quantity": null, 493 | "goods_rate": 10, 494 | "merchant_type": 1, 495 | "goods_mark_price": 2900, 496 | "qr_code_image_url": null, 497 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-10-11/d17fc94e6468566381404ae9a1e9f361.jpeg", 498 | "broker": null, 499 | "opt_id": 1543, 500 | "sale_num_today": null, 501 | "sale_num24": 0, 502 | "min_normal_price": 2680, 503 | "has_coupon": false, 504 | "goods_mall_coupon_price": null, 505 | "mall_rate": 10, 506 | "goods_type": 1, 507 | "create_at": null, 508 | "mall_cps": 1 509 | }, 510 | { 511 | "category_name": "手机", 512 | "coupon_remain_quantity": null, 513 | "serv_pct": null, 514 | "promotion_rate": 10, 515 | "coupon_id": null, 516 | "lock_edit": null, 517 | "mall_id": 327071922, 518 | "share_desc": null, 519 | "mall_name": "白羽家", 520 | "coupon_price": 0, 521 | "rank": null, 522 | "desc_pct": null, 523 | "market_fee": 359, 524 | "goods_name": "弯头数据线苹果oppo华为充电线vivo安卓快充线", 525 | "goods_eval_count": 0, 526 | "goods_id": 4373252800, 527 | "goods_gallery_urls": null, 528 | "goods_desc": null, 529 | "opt_name": "手机", 530 | "opt_ids": [ 531 | 3138, 532 | 1555, 533 | 1543, 534 | 3146, 535 | 1546, 536 | 12, 537 | 3132, 538 | 1246, 539 | 223 540 | ], 541 | "goods_image_url": "http://t00img.yangkeduo.com/goods/images/2018-11-21/625bb4b0c44dc4bc4c735d9af693fc0a.jpeg", 542 | "is_valid": true, 543 | "min_group_price": 1199, 544 | "coupon_start_time": null, 545 | "coupon_discount": 0, 546 | "coupon_end_time": null, 547 | "avg_desc": null, 548 | "avg_serv": null, 549 | "avg_lgst": null, 550 | "sold_quantity": 12, 551 | "cat_ids": null, 552 | "coupon_min_order_amount": 0, 553 | "goods_fact_price": 1199, 554 | "lgst_pct": null, 555 | "category_id": 1543, 556 | "goods_eval_score": 0, 557 | "cat_id": null, 558 | "coupon_total_quantity": null, 559 | "goods_rate": 10, 560 | "merchant_type": 1, 561 | "goods_mark_price": 2499, 562 | "qr_code_image_url": null, 563 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/ad6e5fe5349b9b94d8df2e0f15f84fcc.jpeg", 564 | "broker": null, 565 | "opt_id": 1543, 566 | "sale_num_today": null, 567 | "sale_num24": 0, 568 | "min_normal_price": 1299, 569 | "has_coupon": false, 570 | "goods_mall_coupon_price": null, 571 | "mall_rate": 10, 572 | "goods_type": 1, 573 | "create_at": null, 574 | "mall_cps": 1 575 | } 576 | ], 577 | "request_id": "15451234279400740" 578 | } 579 | } 580 | ''' 581 | 582 | if __name__ == '__main__': 583 | test1() -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /测试/多多进宝主题商品查询1.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # @Time : 2018-12-18 17:09 3 | # @Author : play4fun 4 | # @File : 多多进宝主题商品查询1.py 5 | # @Software: PyCharm 6 | 7 | """ 8 | 多多进宝主题商品查询1.py: 9 | 10 | DdkThemeGoodsSearch 11 | """ 12 | 13 | from ddk.api.rest.DdkThemeGoodsSearch import DdkThemeGoodsSearch 14 | from ddk import appinfo 15 | import traceback, json 16 | from config import pdd_client_id, pdd_client_secret 17 | 18 | 19 | def test1(): 20 | req = DdkThemeGoodsSearch() 21 | req.set_app_info(appinfo(pdd_client_id, secret=pdd_client_secret)) 22 | # 23 | req.theme_id = 3975 24 | try: 25 | resp = req.getResponse() 26 | print(resp) 27 | print('-' * 40) 28 | print(json.dumps(resp)) 29 | 30 | # print(json.dumps(f, ensure_ascii=False)) 31 | except Exception as e: 32 | print(e) 33 | print(traceback.format_exc()) 34 | ''' 35 | { 36 | "theme_list_get_response": { 37 | "total": 20, 38 | "goods_list": [ 39 | { 40 | "avg_desc": 475, 41 | "category_name": "男装", 42 | "coupon_remain_quantity": 8700, 43 | "avg_serv": 478, 44 | "avg_lgst": 479, 45 | "serv_pct": 0.7284, 46 | "promotion_rate": 200, 47 | "sold_quantity": 28, 48 | "cat_ids": [ 49 | 239, 50 | 7287, 51 | 7319, 52 | 0 53 | ], 54 | "coupon_min_order_amount": 97000, 55 | "lgst_pct": 0.7866, 56 | "category_id": 743, 57 | "mall_id": 2265970, 58 | "goods_eval_score": 0, 59 | "cat_id": null, 60 | "mall_name": "俊狮服饰旗舰店", 61 | "coupon_total_quantity": 10000, 62 | "desc_pct": 0.7683, 63 | "merchant_type": 3, 64 | "goods_name": "俊狮冬季长款棉服男韩版纯色宽松连帽外套潮流加厚青年棉衣男", 65 | "goods_eval_count": 0, 66 | "goods_id": 4530990728, 67 | "goods_gallery_urls": null, 68 | "goods_desc": null, 69 | "opt_name": "男装", 70 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/61255ce019a2ae43a3267cb4c04aa36b.jpeg", 71 | "opt_id": 743, 72 | "opt_ids": [ 73 | 225, 74 | 3299, 75 | 1220, 76 | 1236, 77 | 3300, 78 | 743, 79 | 4855, 80 | 6359, 81 | 4856, 82 | 6360, 83 | 12, 84 | 350 85 | ], 86 | "goods_image_url": "", 87 | "min_normal_price": 116900, 88 | "has_coupon": true, 89 | "mall_rate": 100, 90 | "create_at": 1545051302, 91 | "min_group_price": 115900, 92 | "mall_cps": 1, 93 | "coupon_start_time": 1545062400, 94 | "coupon_discount": 97000, 95 | "coupon_end_time": 1545321599 96 | }, 97 | { 98 | "avg_desc": 475, 99 | "category_name": "男装", 100 | "coupon_remain_quantity": 900, 101 | "avg_serv": 478, 102 | "avg_lgst": 479, 103 | "serv_pct": 0.7284, 104 | "promotion_rate": 200, 105 | "sold_quantity": 0, 106 | "cat_ids": [ 107 | 239, 108 | 7287, 109 | 7319, 110 | 0 111 | ], 112 | "coupon_min_order_amount": 101000, 113 | "lgst_pct": 0.7866, 114 | "category_id": 743, 115 | "mall_id": 2265970, 116 | "goods_eval_score": null, 117 | "cat_id": null, 118 | "mall_name": "俊狮服饰旗舰店", 119 | "coupon_total_quantity": 1000, 120 | "desc_pct": 0.7683, 121 | "merchant_type": 3, 122 | "goods_name": "冬季棉服男2018新款韩版宽松棉衣工装面包服小棉袄潮流青少年外套", 123 | "goods_eval_count": 0, 124 | "goods_id": 4530975916, 125 | "goods_gallery_urls": null, 126 | "goods_desc": null, 127 | "opt_name": "男装", 128 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/677ccbafdf30017be34366208b5f0eab.jpeg", 129 | "opt_id": 743, 130 | "opt_ids": [ 131 | 225, 132 | 3299, 133 | 1220, 134 | 1236, 135 | 3300, 136 | 743, 137 | 4855, 138 | 6359, 139 | 4856, 140 | 6360, 141 | 12, 142 | 350 143 | ], 144 | "goods_image_url": "", 145 | "min_normal_price": 118900, 146 | "has_coupon": true, 147 | "mall_rate": 100, 148 | "create_at": 1545051357, 149 | "min_group_price": 117900, 150 | "mall_cps": 1, 151 | "coupon_start_time": 1544976000, 152 | "coupon_discount": 101000, 153 | "coupon_end_time": 1545321599 154 | }, 155 | { 156 | "avg_desc": 475, 157 | "category_name": "男装", 158 | "coupon_remain_quantity": 900, 159 | "avg_serv": 478, 160 | "avg_lgst": 479, 161 | "serv_pct": 0.7284, 162 | "promotion_rate": 300, 163 | "sold_quantity": 0, 164 | "cat_ids": [ 165 | 239, 166 | 7295, 167 | 7307, 168 | 0 169 | ], 170 | "coupon_min_order_amount": 39000, 171 | "lgst_pct": 0.7866, 172 | "category_id": 743, 173 | "mall_id": 2265970, 174 | "goods_eval_score": null, 175 | "cat_id": null, 176 | "mall_name": "俊狮服饰旗舰店", 177 | "coupon_total_quantity": 1000, 178 | "desc_pct": 0.7683, 179 | "merchant_type": 3, 180 | "goods_name": "俊狮秋季直筒休闲裤男2018新款ins超火的裤子潮牌宽松薄款长裤", 181 | "goods_eval_count": 0, 182 | "goods_id": 4528399892, 183 | "goods_gallery_urls": null, 184 | "goods_desc": null, 185 | "opt_name": "男装", 186 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/42cb23672a495a6baae8227b71cf3a8c.jpeg", 187 | "opt_id": 743, 188 | "opt_ids": [ 189 | 225, 190 | 2212, 191 | 743, 192 | 1272, 193 | 12, 194 | 350 195 | ], 196 | "goods_image_url": "", 197 | "min_normal_price": 48900, 198 | "has_coupon": true, 199 | "mall_rate": 100, 200 | "create_at": 1545051866, 201 | "min_group_price": 47900, 202 | "mall_cps": 1, 203 | "coupon_start_time": 1544976000, 204 | "coupon_discount": 39000, 205 | "coupon_end_time": 1545321599 206 | }, 207 | { 208 | "avg_desc": 475, 209 | "category_name": "男装", 210 | "coupon_remain_quantity": 9800, 211 | "avg_serv": 478, 212 | "avg_lgst": 479, 213 | "serv_pct": 0.7284, 214 | "promotion_rate": 250, 215 | "sold_quantity": 5, 216 | "cat_ids": [ 217 | 239, 218 | 248, 219 | 444, 220 | 0 221 | ], 222 | "coupon_min_order_amount": 34000, 223 | "lgst_pct": 0.7866, 224 | "category_id": 743, 225 | "mall_id": 2265970, 226 | "goods_eval_score": null, 227 | "cat_id": null, 228 | "mall_name": "俊狮服饰旗舰店", 229 | "coupon_total_quantity": 10000, 230 | "desc_pct": 0.7683, 231 | "merchant_type": 3, 232 | "goods_name": "俊狮秋冬毛衣男韩版圆领撞色字母套头针织衫潮牌宽松薄款外套", 233 | "goods_eval_count": 0, 234 | "goods_id": 4531422886, 235 | "goods_gallery_urls": null, 236 | "goods_desc": null, 237 | "opt_name": "男装", 238 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-27/aaf57594496912de0c0946425920c032.jpeg", 239 | "opt_id": 743, 240 | "opt_ids": [ 241 | 4864, 242 | 2592, 243 | 225, 244 | 6196, 245 | 743, 246 | 4855, 247 | 6187, 248 | 12, 249 | 350, 250 | 2590 251 | ], 252 | "goods_image_url": "", 253 | "min_normal_price": 42900, 254 | "has_coupon": true, 255 | "mall_rate": 100, 256 | "create_at": 1545052037, 257 | "min_group_price": 41900, 258 | "mall_cps": 1, 259 | "coupon_start_time": 1545062400, 260 | "coupon_discount": 34000, 261 | "coupon_end_time": 1545321599 262 | }, 263 | { 264 | "avg_desc": 475, 265 | "category_name": "男装", 266 | "coupon_remain_quantity": 800, 267 | "avg_serv": 478, 268 | "avg_lgst": 479, 269 | "serv_pct": 0.7284, 270 | "promotion_rate": 200, 271 | "sold_quantity": 1, 272 | "cat_ids": [ 273 | 239, 274 | 7297, 275 | 7322, 276 | 0 277 | ], 278 | "coupon_min_order_amount": 97000, 279 | "lgst_pct": 0.7866, 280 | "category_id": 743, 281 | "mall_id": 2265970, 282 | "goods_eval_score": null, 283 | "cat_id": null, 284 | "mall_name": "俊狮服饰旗舰店", 285 | "coupon_total_quantity": 1000, 286 | "desc_pct": 0.7683, 287 | "merchant_type": 3, 288 | "goods_name": "俊狮棒球羽绒服男韩版短款青年冬季保暖外套修身帅气羽绒衣服", 289 | "goods_eval_count": 0, 290 | "goods_id": 4527903318, 291 | "goods_gallery_urls": null, 292 | "goods_desc": null, 293 | "opt_name": "男装", 294 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/5349a9fa3d87f608aedac344120b9e0e.jpeg", 295 | "opt_id": 743, 296 | "opt_ids": [ 297 | 225, 298 | 3297, 299 | 3298, 300 | 743, 301 | 4855, 302 | 4857, 303 | 6361, 304 | 6362, 305 | 12, 306 | 350 307 | ], 308 | "goods_image_url": "", 309 | "min_normal_price": 114900, 310 | "has_coupon": true, 311 | "mall_rate": 100, 312 | "create_at": 1545051147, 313 | "min_group_price": 113900, 314 | "mall_cps": 1, 315 | "coupon_start_time": 1544976000, 316 | "coupon_discount": 97000, 317 | "coupon_end_time": 1545321599 318 | }, 319 | { 320 | "avg_desc": 475, 321 | "category_name": "男装", 322 | "coupon_remain_quantity": 900, 323 | "avg_serv": 478, 324 | "avg_lgst": 479, 325 | "serv_pct": 0.7284, 326 | "promotion_rate": 200, 327 | "sold_quantity": 1, 328 | "cat_ids": [ 329 | 239, 330 | 7297, 331 | 7322, 332 | 0 333 | ], 334 | "coupon_min_order_amount": 148000, 335 | "lgst_pct": 0.7866, 336 | "category_id": 743, 337 | "mall_id": 2265970, 338 | "goods_eval_score": null, 339 | "cat_id": null, 340 | "mall_name": "俊狮服饰旗舰店", 341 | "coupon_total_quantity": 1000, 342 | "desc_pct": 0.7683, 343 | "merchant_type": 3, 344 | "goods_name": "俊狮男士羽绒服2018新款韩版短款羽绒夹克冬季棒球领帅气外套", 345 | "goods_eval_count": 0, 346 | "goods_id": 4527954157, 347 | "goods_gallery_urls": null, 348 | "goods_desc": null, 349 | "opt_name": "男装", 350 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/a019587a60fea3dd4be9a5717c599f9e.jpeg", 351 | "opt_id": 743, 352 | "opt_ids": [ 353 | 225, 354 | 3297, 355 | 3298, 356 | 743, 357 | 4855, 358 | 4857, 359 | 6361, 360 | 6362, 361 | 12, 362 | 350 363 | ], 364 | "goods_image_url": "", 365 | "min_normal_price": 168900, 366 | "has_coupon": true, 367 | "mall_rate": 100, 368 | "create_at": 1545051203, 369 | "min_group_price": 167900, 370 | "mall_cps": 1, 371 | "coupon_start_time": 1544976000, 372 | "coupon_discount": 148000, 373 | "coupon_end_time": 1545321599 374 | }, 375 | { 376 | "avg_desc": 475, 377 | "category_name": "男装", 378 | "coupon_remain_quantity": 800, 379 | "avg_serv": 478, 380 | "avg_lgst": 479, 381 | "serv_pct": 0.7284, 382 | "promotion_rate": 200, 383 | "sold_quantity": 2, 384 | "cat_ids": [ 385 | 239, 386 | 7287, 387 | 7319, 388 | 0 389 | ], 390 | "coupon_min_order_amount": 90000, 391 | "lgst_pct": 0.7866, 392 | "category_id": 743, 393 | "mall_id": 2265970, 394 | "goods_eval_score": null, 395 | "cat_id": null, 396 | "mall_name": "俊狮服饰旗舰店", 397 | "coupon_total_quantity": 1000, 398 | "desc_pct": 0.7683, 399 | "merchant_type": 3, 400 | "goods_name": "俊狮冬季棉衣男装韩版潮流帅气冬天衣服保暖外套修身棉服男", 401 | "goods_eval_count": 0, 402 | "goods_id": 4530982755, 403 | "goods_gallery_urls": null, 404 | "goods_desc": null, 405 | "opt_name": "男装", 406 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/dc87b298c97cc6849e37d78799d83734.jpeg", 407 | "opt_id": 743, 408 | "opt_ids": [ 409 | 225, 410 | 3299, 411 | 1220, 412 | 1236, 413 | 3300, 414 | 743, 415 | 4855, 416 | 6359, 417 | 4856, 418 | 6360, 419 | 12, 420 | 350 421 | ], 422 | "goods_image_url": "", 423 | "min_normal_price": 108900, 424 | "has_coupon": true, 425 | "mall_rate": 100, 426 | "create_at": 1545051255, 427 | "min_group_price": 107900, 428 | "mall_cps": 1, 429 | "coupon_start_time": 1544976000, 430 | "coupon_discount": 90000, 431 | "coupon_end_time": 1545321599 432 | }, 433 | { 434 | "avg_desc": 475, 435 | "category_name": "男装", 436 | "coupon_remain_quantity": 500, 437 | "avg_serv": 478, 438 | "avg_lgst": 479, 439 | "serv_pct": 0.7284, 440 | "promotion_rate": 200, 441 | "sold_quantity": 5, 442 | "cat_ids": [ 443 | 239, 444 | 7287, 445 | 7319, 446 | 0 447 | ], 448 | "coupon_min_order_amount": 96000, 449 | "lgst_pct": 0.7866, 450 | "category_id": 743, 451 | "mall_id": 2265970, 452 | "goods_eval_score": null, 453 | "cat_id": null, 454 | "mall_name": "俊狮服饰旗舰店", 455 | "coupon_total_quantity": 1000, 456 | "desc_pct": 0.7683, 457 | "merchant_type": 3, 458 | "goods_name": "俊狮冬装网红棉服男短款青年帅气休闲棉袄修身棒球服潮牌夹克", 459 | "goods_eval_count": 0, 460 | "goods_id": 4530974928, 461 | "goods_gallery_urls": null, 462 | "goods_desc": null, 463 | "opt_name": "男装", 464 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/4f341eb805389e06fcd2463a32c13479.jpeg", 465 | "opt_id": 743, 466 | "opt_ids": [ 467 | 225, 468 | 3299, 469 | 1220, 470 | 1236, 471 | 3300, 472 | 743, 473 | 4855, 474 | 6359, 475 | 4856, 476 | 6360, 477 | 12, 478 | 350 479 | ], 480 | "goods_image_url": "", 481 | "min_normal_price": 116900, 482 | "has_coupon": true, 483 | "mall_rate": 100, 484 | "create_at": 1545051410, 485 | "min_group_price": 115900, 486 | "mall_cps": 1, 487 | "coupon_start_time": 1544976000, 488 | "coupon_discount": 96000, 489 | "coupon_end_time": 1545321599 490 | }, 491 | { 492 | "avg_desc": 475, 493 | "category_name": "男装", 494 | "coupon_remain_quantity": 900, 495 | "avg_serv": 478, 496 | "avg_lgst": 479, 497 | "serv_pct": 0.7284, 498 | "promotion_rate": 200, 499 | "sold_quantity": 1, 500 | "cat_ids": [ 501 | 239, 502 | 7287, 503 | 7319, 504 | 0 505 | ], 506 | "coupon_min_order_amount": 115000, 507 | "lgst_pct": 0.7866, 508 | "category_id": 743, 509 | "mall_id": 2265970, 510 | "goods_eval_score": null, 511 | "cat_id": null, 512 | "mall_name": "俊狮服饰旗舰店", 513 | "coupon_total_quantity": 1000, 514 | "desc_pct": 0.7683, 515 | "merchant_type": 3, 516 | "goods_name": "俊狮短款男棉衣潮流修身男外套袄子2018新款韩版帅气修身棉服", 517 | "goods_eval_count": 0, 518 | "goods_id": 4551597335, 519 | "goods_gallery_urls": null, 520 | "goods_desc": null, 521 | "opt_name": "男装", 522 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/64cf167a31168c0947669d4ee5babc59.jpeg", 523 | "opt_id": 743, 524 | "opt_ids": [ 525 | 225, 526 | 3299, 527 | 1220, 528 | 1236, 529 | 3300, 530 | 743, 531 | 4855, 532 | 6359, 533 | 4856, 534 | 6360, 535 | 12, 536 | 350 537 | ], 538 | "goods_image_url": "", 539 | "min_normal_price": 130900, 540 | "has_coupon": true, 541 | "mall_rate": 100, 542 | "create_at": 1545051469, 543 | "min_group_price": 129900, 544 | "mall_cps": 1, 545 | "coupon_start_time": 1544976000, 546 | "coupon_discount": 115000, 547 | "coupon_end_time": 1545321599 548 | }, 549 | { 550 | "avg_desc": 475, 551 | "category_name": "男装", 552 | "coupon_remain_quantity": 900, 553 | "avg_serv": 478, 554 | "avg_lgst": 479, 555 | "serv_pct": 0.7284, 556 | "promotion_rate": 200, 557 | "sold_quantity": 0, 558 | "cat_ids": [ 559 | 239, 560 | 7287, 561 | 7319, 562 | 0 563 | ], 564 | "coupon_min_order_amount": 120000, 565 | "lgst_pct": 0.7866, 566 | "category_id": 743, 567 | "mall_id": 2265970, 568 | "goods_eval_score": null, 569 | "cat_id": null, 570 | "mall_name": "俊狮服饰旗舰店", 571 | "coupon_total_quantity": 1000, 572 | "desc_pct": 0.7683, 573 | "merchant_type": 3, 574 | "goods_name": "no1dara冬装外套男棉服韩版棉衣男装加绒加厚短款爸爸装中年棉袄", 575 | "goods_eval_count": 0, 576 | "goods_id": 4531071382, 577 | "goods_gallery_urls": null, 578 | "goods_desc": null, 579 | "opt_name": "男装", 580 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-27/2d5a66ba12c2df3c07ac6bff764a7b38.jpeg", 581 | "opt_id": 743, 582 | "opt_ids": [ 583 | 225, 584 | 3299, 585 | 1220, 586 | 1236, 587 | 3300, 588 | 743, 589 | 4855, 590 | 6359, 591 | 4856, 592 | 6360, 593 | 12, 594 | 350 595 | ], 596 | "goods_image_url": "http://t00img.yangkeduo.com/openapi/images/2018-11-27/7f9d4e8e5448272eed150f9366decfcb.jpeg", 597 | "min_normal_price": 140900, 598 | "has_coupon": true, 599 | "mall_rate": 100, 600 | "create_at": 1545051523, 601 | "min_group_price": 139900, 602 | "mall_cps": 1, 603 | "coupon_start_time": 1544976000, 604 | "coupon_discount": 120000, 605 | "coupon_end_time": 1545321599 606 | }, 607 | { 608 | "avg_desc": 475, 609 | "category_name": "男装", 610 | "coupon_remain_quantity": 800, 611 | "avg_serv": 478, 612 | "avg_lgst": 479, 613 | "serv_pct": 0.7284, 614 | "promotion_rate": 200, 615 | "sold_quantity": 4, 616 | "cat_ids": [ 617 | 239, 618 | 7287, 619 | 7319, 620 | 0 621 | ], 622 | "coupon_min_order_amount": 87000, 623 | "lgst_pct": 0.7866, 624 | "category_id": 743, 625 | "mall_id": 2265970, 626 | "goods_eval_score": null, 627 | "cat_id": null, 628 | "mall_name": "俊狮服饰旗舰店", 629 | "coupon_total_quantity": 1000, 630 | "desc_pct": 0.7683, 631 | "merchant_type": 3, 632 | "goods_name": "男士外套冬季2017新款羽绒男装棉衣韩版修身潮流棉服帅气加厚棉袄", 633 | "goods_eval_count": 0, 634 | "goods_id": 4531083240, 635 | "goods_gallery_urls": null, 636 | "goods_desc": null, 637 | "opt_name": "男装", 638 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-27/1e7e93f171df8161db15a7c1a2d23e42.jpeg", 639 | "opt_id": 743, 640 | "opt_ids": [ 641 | 225, 642 | 3299, 643 | 1220, 644 | 1236, 645 | 3300, 646 | 743, 647 | 4855, 648 | 6359, 649 | 4856, 650 | 6360, 651 | 12, 652 | 350 653 | ], 654 | "goods_image_url": "http://t00img.yangkeduo.com/openapi/images/2018-11-27/fa84ef47fe9b2d331c84a0f0422b1c28.jpeg", 655 | "min_normal_price": 106900, 656 | "has_coupon": true, 657 | "mall_rate": 100, 658 | "create_at": 1545051570, 659 | "min_group_price": 105900, 660 | "mall_cps": 1, 661 | "coupon_start_time": 1544976000, 662 | "coupon_discount": 87000, 663 | "coupon_end_time": 1545321599 664 | }, 665 | { 666 | "avg_desc": 475, 667 | "category_name": "男装", 668 | "coupon_remain_quantity": 900, 669 | "avg_serv": 478, 670 | "avg_lgst": 479, 671 | "serv_pct": 0.7284, 672 | "promotion_rate": 200, 673 | "sold_quantity": 1, 674 | "cat_ids": [ 675 | 239, 676 | 7287, 677 | 7319, 678 | 0 679 | ], 680 | "coupon_min_order_amount": 85000, 681 | "lgst_pct": 0.7866, 682 | "category_id": 743, 683 | "mall_id": 2265970, 684 | "goods_eval_score": null, 685 | "cat_id": null, 686 | "mall_name": "俊狮服饰旗舰店", 687 | "coupon_total_quantity": 1000, 688 | "desc_pct": 0.7683, 689 | "merchant_type": 3, 690 | "goods_name": "保暖背心潮流男士棉马甲男秋冬季韩版坎肩帅气修身羽绒棉外套男", 691 | "goods_eval_count": 0, 692 | "goods_id": 4531097001, 693 | "goods_gallery_urls": null, 694 | "goods_desc": null, 695 | "opt_name": "男装", 696 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-27/3ba7b7d8ca2e3a64dd3c0ff894fda158.jpeg", 697 | "opt_id": 743, 698 | "opt_ids": [ 699 | 225, 700 | 3299, 701 | 1220, 702 | 1236, 703 | 3300, 704 | 743, 705 | 4855, 706 | 6359, 707 | 4856, 708 | 6360, 709 | 12, 710 | 350 711 | ], 712 | "goods_image_url": "http://t00img.yangkeduo.com/openapi/images/2018-11-27/ac740a93931b576dce062cf7d4fe05ff.jpeg", 713 | "min_normal_price": 102900, 714 | "has_coupon": true, 715 | "mall_rate": 100, 716 | "create_at": 1545051613, 717 | "min_group_price": 101900, 718 | "mall_cps": 1, 719 | "coupon_start_time": 1544976000, 720 | "coupon_discount": 85000, 721 | "coupon_end_time": 1545321599 722 | }, 723 | { 724 | "avg_desc": 475, 725 | "category_name": "男装", 726 | "coupon_remain_quantity": 900, 727 | "avg_serv": 478, 728 | "avg_lgst": 479, 729 | "serv_pct": 0.7284, 730 | "promotion_rate": 250, 731 | "sold_quantity": 0, 732 | "cat_ids": [ 733 | 239, 734 | 7295, 735 | 7307, 736 | 0 737 | ], 738 | "coupon_min_order_amount": 40000, 739 | "lgst_pct": 0.7866, 740 | "category_id": 743, 741 | "mall_id": 2265970, 742 | "goods_eval_score": null, 743 | "cat_id": null, 744 | "mall_name": "俊狮服饰旗舰店", 745 | "coupon_total_quantity": 1000, 746 | "desc_pct": 0.7683, 747 | "merchant_type": 3, 748 | "goods_name": "俊狮韩版休闲裤男潮流三条杠运动裤宽松百搭卫裤直筒网红裤子", 749 | "goods_eval_count": 0, 750 | "goods_id": 4528339426, 751 | "goods_gallery_urls": null, 752 | "goods_desc": null, 753 | "opt_name": "男装", 754 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/acc8156a65a75e7e597b86a5f230522d.jpeg", 755 | "opt_id": 743, 756 | "opt_ids": [ 757 | 225, 758 | 2212, 759 | 743, 760 | 1272, 761 | 12, 762 | 350 763 | ], 764 | "goods_image_url": "", 765 | "min_normal_price": 48900, 766 | "has_coupon": true, 767 | "mall_rate": 100, 768 | "create_at": 1545051660, 769 | "min_group_price": 47900, 770 | "mall_cps": 1, 771 | "coupon_start_time": 1544976000, 772 | "coupon_discount": 40000, 773 | "coupon_end_time": 1545321599 774 | }, 775 | { 776 | "avg_desc": 475, 777 | "category_name": "男装", 778 | "coupon_remain_quantity": 300, 779 | "avg_serv": 478, 780 | "avg_lgst": 479, 781 | "serv_pct": 0.7284, 782 | "promotion_rate": 250, 783 | "sold_quantity": 16, 784 | "cat_ids": [ 785 | 239, 786 | 7295, 787 | 7307, 788 | 0 789 | ], 790 | "coupon_min_order_amount": 41000, 791 | "lgst_pct": 0.7866, 792 | "category_id": 743, 793 | "mall_id": 2265970, 794 | "goods_eval_score": 0, 795 | "cat_id": null, 796 | "mall_name": "俊狮服饰旗舰店", 797 | "coupon_total_quantity": 1000, 798 | "desc_pct": 0.7683, 799 | "merchant_type": 3, 800 | "goods_name": "俊狮2018加绒束脚裤男冬季韩版休闲裤潮流网红运动长裤子套装", 801 | "goods_eval_count": 0, 802 | "goods_id": 4528335369, 803 | "goods_gallery_urls": null, 804 | "goods_desc": null, 805 | "opt_name": "男装", 806 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/f15ce6468c436885143baa3f4e68ea50.jpeg", 807 | "opt_id": 743, 808 | "opt_ids": [ 809 | 225, 810 | 2212, 811 | 743, 812 | 1272, 813 | 12, 814 | 350 815 | ], 816 | "goods_image_url": "", 817 | "min_normal_price": 50900, 818 | "has_coupon": true, 819 | "mall_rate": 100, 820 | "create_at": 1545051705, 821 | "min_group_price": 49900, 822 | "mall_cps": 1, 823 | "coupon_start_time": 1544976000, 824 | "coupon_discount": 41000, 825 | "coupon_end_time": 1545321599 826 | }, 827 | { 828 | "avg_desc": 475, 829 | "category_name": "男装", 830 | "coupon_remain_quantity": 900, 831 | "avg_serv": 478, 832 | "avg_lgst": 479, 833 | "serv_pct": 0.7284, 834 | "promotion_rate": 250, 835 | "sold_quantity": 0, 836 | "cat_ids": [ 837 | 239, 838 | 7295, 839 | 7307, 840 | 0 841 | ], 842 | "coupon_min_order_amount": 46000, 843 | "lgst_pct": 0.7866, 844 | "category_id": 743, 845 | "mall_id": 2265970, 846 | "goods_eval_score": null, 847 | "cat_id": null, 848 | "mall_name": "俊狮服饰旗舰店", 849 | "coupon_total_quantity": 1000, 850 | "desc_pct": 0.7683, 851 | "merchant_type": 3, 852 | "goods_name": "俊狮男裤2018秋季新款韩版时尚男士裤子潮流修身系带休闲裤", 853 | "goods_eval_count": 0, 854 | "goods_id": 4528361744, 855 | "goods_gallery_urls": null, 856 | "goods_desc": null, 857 | "opt_name": "男装", 858 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/5f61ab203d8274e6d51dce34ccae753a.jpeg", 859 | "opt_id": 743, 860 | "opt_ids": [ 861 | 225, 862 | 2212, 863 | 743, 864 | 1272, 865 | 12, 866 | 350 867 | ], 868 | "goods_image_url": "", 869 | "min_normal_price": 54900, 870 | "has_coupon": true, 871 | "mall_rate": 100, 872 | "create_at": 1545051751, 873 | "min_group_price": 53900, 874 | "mall_cps": 1, 875 | "coupon_start_time": 1544976000, 876 | "coupon_discount": 46000, 877 | "coupon_end_time": 1545321599 878 | }, 879 | { 880 | "avg_desc": 475, 881 | "category_name": "男装", 882 | "coupon_remain_quantity": 900, 883 | "avg_serv": 478, 884 | "avg_lgst": 479, 885 | "serv_pct": 0.7284, 886 | "promotion_rate": 200, 887 | "sold_quantity": 0, 888 | "cat_ids": [ 889 | 239, 890 | 7295, 891 | 7307, 892 | 0 893 | ], 894 | "coupon_min_order_amount": 61000, 895 | "lgst_pct": 0.7866, 896 | "category_id": 743, 897 | "mall_id": 2265970, 898 | "goods_eval_score": null, 899 | "cat_id": null, 900 | "mall_name": "俊狮服饰旗舰店", 901 | "coupon_total_quantity": 1000, 902 | "desc_pct": 0.7683, 903 | "merchant_type": 3, 904 | "goods_name": "俊狮秋季休闲裤男韩版新款撞色拼接束脚运动裤潮牌宽松长裤子", 905 | "goods_eval_count": 0, 906 | "goods_id": 4528355780, 907 | "goods_gallery_urls": null, 908 | "goods_desc": null, 909 | "opt_name": "男装", 910 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-28/8178063823933edef41b0297f193ebd9.jpeg", 911 | "opt_id": 743, 912 | "opt_ids": [ 913 | 225, 914 | 2212, 915 | 743, 916 | 1272, 917 | 12, 918 | 350 919 | ], 920 | "goods_image_url": "", 921 | "min_normal_price": 70900, 922 | "has_coupon": true, 923 | "mall_rate": 100, 924 | "create_at": 1545052367, 925 | "min_group_price": 69900, 926 | "mall_cps": 1, 927 | "coupon_start_time": 1544976000, 928 | "coupon_discount": 61000, 929 | "coupon_end_time": 1545321599 930 | }, 931 | { 932 | "avg_desc": 475, 933 | "category_name": "男装", 934 | "coupon_remain_quantity": 900, 935 | "avg_serv": 478, 936 | "avg_lgst": 479, 937 | "serv_pct": 0.7284, 938 | "promotion_rate": 200, 939 | "sold_quantity": 1, 940 | "cat_ids": [ 941 | 239, 942 | 248, 943 | 444, 944 | 0 945 | ], 946 | "coupon_min_order_amount": 46000, 947 | "lgst_pct": 0.7866, 948 | "category_id": 743, 949 | "mall_id": 2265970, 950 | "goods_eval_score": null, 951 | "cat_id": null, 952 | "mall_name": "俊狮服饰旗舰店", 953 | "coupon_total_quantity": 1000, 954 | "desc_pct": 0.7683, 955 | "merchant_type": 3, 956 | "goods_name": "俊狮针织衫男秋季2018新款休闲白色毛衣韩版套头中领加厚线衫", 957 | "goods_eval_count": 0, 958 | "goods_id": 4531353766, 959 | "goods_gallery_urls": null, 960 | "goods_desc": null, 961 | "opt_name": "男装", 962 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-27/851721008d8ab6f4fbc76ad20df7fc4c.jpeg", 963 | "opt_id": 743, 964 | "opt_ids": [ 965 | 4864, 966 | 2592, 967 | 225, 968 | 6196, 969 | 743, 970 | 4855, 971 | 6187, 972 | 12, 973 | 350, 974 | 2590 975 | ], 976 | "goods_image_url": "", 977 | "min_normal_price": 54900, 978 | "has_coupon": true, 979 | "mall_rate": 100, 980 | "create_at": 1545051922, 981 | "min_group_price": 53900, 982 | "mall_cps": 1, 983 | "coupon_start_time": 1544976000, 984 | "coupon_discount": 46000, 985 | "coupon_end_time": 1545321599 986 | }, 987 | { 988 | "avg_desc": 475, 989 | "category_name": "男装", 990 | "coupon_remain_quantity": 900, 991 | "avg_serv": 478, 992 | "avg_lgst": 479, 993 | "serv_pct": 0.7284, 994 | "promotion_rate": 250, 995 | "sold_quantity": 0, 996 | "cat_ids": [ 997 | 239, 998 | 248, 999 | 444, 1000 | 0 1001 | ], 1002 | "coupon_min_order_amount": 43000, 1003 | "lgst_pct": 0.7866, 1004 | "category_id": 743, 1005 | "mall_id": 2265970, 1006 | "goods_eval_score": null, 1007 | "cat_id": null, 1008 | "mall_name": "俊狮服饰旗舰店", 1009 | "coupon_total_quantity": 1000, 1010 | "desc_pct": 0.7683, 1011 | "merchant_type": 3, 1012 | "goods_name": "俊狮高领毛衣男冬季修身韩版毛衫帅气青少年潮流学生款针织衫", 1013 | "goods_eval_count": 0, 1014 | "goods_id": 4531396672, 1015 | "goods_gallery_urls": null, 1016 | "goods_desc": null, 1017 | "opt_name": "男装", 1018 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-27/227804a92b48bdfcf2ff4e2c91483ee7.jpeg", 1019 | "opt_id": 743, 1020 | "opt_ids": [ 1021 | 4864, 1022 | 2592, 1023 | 225, 1024 | 6196, 1025 | 743, 1026 | 4855, 1027 | 6187, 1028 | 12, 1029 | 350, 1030 | 2590 1031 | ], 1032 | "goods_image_url": "", 1033 | "min_normal_price": 52900, 1034 | "has_coupon": true, 1035 | "mall_rate": 100, 1036 | "create_at": 1545051970, 1037 | "min_group_price": 51900, 1038 | "mall_cps": 1, 1039 | "coupon_start_time": 1544976000, 1040 | "coupon_discount": 43000, 1041 | "coupon_end_time": 1545321599 1042 | }, 1043 | { 1044 | "avg_desc": 475, 1045 | "category_name": "男装", 1046 | "coupon_remain_quantity": 900, 1047 | "avg_serv": 478, 1048 | "avg_lgst": 479, 1049 | "serv_pct": 0.7284, 1050 | "promotion_rate": 200, 1051 | "sold_quantity": 1, 1052 | "cat_ids": [ 1053 | 239, 1054 | 248, 1055 | 444, 1056 | 0 1057 | ], 1058 | "coupon_min_order_amount": 43000, 1059 | "lgst_pct": 0.7866, 1060 | "category_id": 743, 1061 | "mall_id": 2265970, 1062 | "goods_eval_score": null, 1063 | "cat_id": null, 1064 | "mall_name": "俊狮服饰旗舰店", 1065 | "coupon_total_quantity": 1000, 1066 | "desc_pct": 0.7683, 1067 | "merchant_type": 3, 1068 | "goods_name": "毛衣男冬季2018新款韩版圆领加厚毛衫潮流线衫学生慵懒风男针织衫", 1069 | "goods_eval_count": 0, 1070 | "goods_id": 4531401639, 1071 | "goods_gallery_urls": null, 1072 | "goods_desc": null, 1073 | "opt_name": "男装", 1074 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-27/5035b72a8a574f71e1a6f9c5d06bbbaf.jpeg", 1075 | "opt_id": 743, 1076 | "opt_ids": [ 1077 | 4864, 1078 | 2592, 1079 | 225, 1080 | 6196, 1081 | 743, 1082 | 4855, 1083 | 6187, 1084 | 12, 1085 | 350, 1086 | 2590 1087 | ], 1088 | "goods_image_url": "", 1089 | "min_normal_price": 50900, 1090 | "has_coupon": true, 1091 | "mall_rate": 100, 1092 | "create_at": 1545052416, 1093 | "min_group_price": 49900, 1094 | "mall_cps": 1, 1095 | "coupon_start_time": 1544976000, 1096 | "coupon_discount": 43000, 1097 | "coupon_end_time": 1545321599 1098 | }, 1099 | { 1100 | "avg_desc": 475, 1101 | "category_name": "男装", 1102 | "coupon_remain_quantity": 900, 1103 | "avg_serv": 478, 1104 | "avg_lgst": 479, 1105 | "serv_pct": 0.7284, 1106 | "promotion_rate": 250, 1107 | "sold_quantity": 0, 1108 | "cat_ids": [ 1109 | 239, 1110 | 248, 1111 | 444, 1112 | 0 1113 | ], 1114 | "coupon_min_order_amount": 41000, 1115 | "lgst_pct": 0.7866, 1116 | "category_id": 743, 1117 | "mall_id": 2265970, 1118 | "goods_eval_score": null, 1119 | "cat_id": null, 1120 | "mall_name": "俊狮服饰旗舰店", 1121 | "coupon_total_quantity": 1000, 1122 | "desc_pct": 0.7683, 1123 | "merchant_type": 3, 1124 | "goods_name": "俊狮黑色毛衣男秋冬韩版假两件修身线衫圆领线衣潮牌薄款外套", 1125 | "goods_eval_count": 0, 1126 | "goods_id": 4531467762, 1127 | "goods_gallery_urls": null, 1128 | "goods_desc": null, 1129 | "opt_name": "男装", 1130 | "goods_thumbnail_url": "http://t00img.yangkeduo.com/goods/images/2018-11-27/f179258814bf01c15ec9e5dd5f2de282.jpeg", 1131 | "opt_id": 743, 1132 | "opt_ids": [ 1133 | 4864, 1134 | 2592, 1135 | 225, 1136 | 6196, 1137 | 743, 1138 | 4855, 1139 | 6187, 1140 | 12, 1141 | 350, 1142 | 2590 1143 | ], 1144 | "goods_image_url": "", 1145 | "min_normal_price": 50900, 1146 | "has_coupon": true, 1147 | "mall_rate": 100, 1148 | "create_at": 1545052083, 1149 | "min_group_price": 49900, 1150 | "mall_cps": 1, 1151 | "coupon_start_time": 1544976000, 1152 | "coupon_discount": 41000, 1153 | "coupon_end_time": 1545321599 1154 | } 1155 | ], 1156 | "request_id": "15451260721836886" 1157 | } 1158 | } 1159 | ''' 1160 | 1161 | if __name__ == '__main__': 1162 | test1() 1163 | --------------------------------------------------------------------------------