def recommendPage(self): '''首页推荐top4 分类下的top3品牌的top1商品''' url = get_peizhi(wenjianming='xiaoxiang_api', yaml_name='dapaijiangjia', content_name='xiaoxiang_api_test.yaml')[ 'recommendPage'] # 获取url['recommendPage'] token = get_peizhi(wenjianming='xiaoxiang_peizhi', yaml_name='token', content_name='xiaoxiang_token.yaml') # 获取header data = {'token': token} response = request_post(base_url=url, dict_data=data, header='') #print(response) return response
def oneCategoryPage(self, oneCategoryId): '''一级类目下的每个二级类目的top3商品''' url = get_peizhi( wenjianming='xiaoxiang_api', yaml_name='dapaijiangjia', content_name='xiaoxiang_api_test.yaml')['oneCategoryPage'] token = get_peizhi(wenjianming='xiaoxiang_peizhi', yaml_name='token', content_name='xiaoxiang_token.yaml') data = { 'token': token, 'oneCategoryId': oneCategoryId } # oneCategoryId一级类目id response = request_post(base_url=url, dict_data=data, header='') #print(response) return response
def cash(self): '''用户现金奖励明细接口''' url = get_peizhi(wenjianming='xiaoxiang_api', yaml_name='nianhuojie', content_name='xiaoxiang_api_test.yaml')[ 'cash'] # 获取url['recommendPage'] logging.info("请求的url为:%s" % url) token = get_peizhi(wenjianming='xiaoxiang_peizhi', yaml_name='token', content_name='xiaoxiang_token.yaml') # 获取header header = self.get_header() logging.info("请求的header为:%s" % header) data = {'token': token} logging.info("请求的data为:%s" % data) logging.info("正在请求......") response = request_post(base_url=url, dict_data=data, header=header) print(response) return response
def categoryGoods(self, categoryId): '''获取二级类目下的品牌以及品牌下的商品''' url = self.get_url(yaml_name='dapaijiangjia')['categoryGoods'] token = get_peizhi(wenjianming='xiaoxiang_peizhi', yaml_name='token', content_name='xiaoxiang_token.yaml') data = {'categoryId': categoryId, 'token': token} # 类目id response = request_post(base_url=url, dict_data=data, header='') return response
def yi_threeGoods(self, oneId): '''一级类目降价排行top3商品''' url = get_peizhi( wenjianming='xiaoxiang_api', yaml_name='dapaijiangjia', content_name='xiaoxiang_api_test.yaml')['yi_threeGoods'] data = {'oneId': oneId, 'pageNum': 10, 'currentPage': 1} # 一级类目ID response = request_post(base_url=url, dict_data=data, header='') return response
def queryCashOrNot(self): '''查询用户是否能兑奖''' url = get_peizhi(wenjianming='xiaoxiang_api', yaml_name='nianhuojie', content_name='xiaoxiang_api_test.yaml')[ 'queryCashOrNot'] # 获取url['recommendPage'] logging.info("请求的url为:%s" % url) token = get_peizhi(wenjianming='xiaoxiang_peizhi', yaml_name='token', content_name='xiaoxiang_token.yaml') # 获取header logging.info("token:%s" % token) header = self.get_header() logging.info("请求的header为:%s" % header) data = {'token': token} logging.info("请求的data为:%s" % data) logging.info("正在请求......") response = request_post(base_url=url, dict_data=data, header=header) logging.info("请求结束......") print(response) return response
def shouye_threeGoods(self, pageNum, currentPage): '''一级类目下的每个二级类目的top3商品''' url = get_peizhi(wenjianming='xiaoxiang_api', yaml_name='dapaijiangjia', content_name='xiaoxiang_api_test.yaml')['threeGoods'] data = { 'pageNum': pageNum, 'currentPage': currentPage } # oneCategoryId一级类目id response = request_post(base_url=url, dict_data=data, header='') #print(response) return response
def __init__(self): '''读取配置信息''' self.url = get_peizhi(wenjianming='xiaoxiang_api', yaml_name='Login', content_name='xiaoxiang_api_test.yaml') # 获取url