Esempio n. 1
0
 def import_wx_flow_free(self,
                         token=None,
                         type=1,
                         subject_id=280,
                         subject_name='PHP'):
     """
     学员录入--导入(微信流量)--拥有【免费流量组】
     """
     if type == 1:
         data = self._data.get('student_input_import_for_wx_free')
     else:
         data = self._data.get('student_input_import_for_wx_free_perssion')
     url, method, header, params, shared, check = cotool.deal_data(data)
     excel = {
         "1": ['客户姓名', '手机号码', 'QQ号码', '微信号', 'QQ群'],
         "2": ['lily', '13012345678', '23121231', '123456', '123456']
     }
     if token is None:
         if rc.get_env() == 'pre':
             token = login.login_action('t0322511032')
         else:
             token = login.login_action('m17673155297')
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     header['token'] = token
     params['subjectId'] = subject_id
     params['subjectName'] = subject_name
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
Esempio n. 2
0
 def delete_carrier(self, id):
     data = self._data.get('delete_carrier')
     url, method, header, params, shared, check = cotool.deal_data(data)
     url = url + str(id)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 3
0
    def query_zt_info(self, isEnterpriseWx=0, **kwargs):
        '''
        查询载体信息
        :param isEnterpriseWx: 载体类型,0微信 1企业微信
        :param kwargs: 载体名称 vector=***
        :return:
        '''

        if isEnterpriseWx == 0:
            data = self._data.get('query_zt_info_for_person')
            url, method, header, params, shared, check = cotool.deal_data(data)
            params['isEnterpriseWx'] = isEnterpriseWx
            if kwargs:
                params = dict(params, **kwargs)
            res = httprequest(url, method, header, params)
            cotool.extract_variable(res, shared)
            cotool.assert_res(res, check)
            return res
        else:
            data = self._data.get('query_zt_info_for_company')
            url, method, header, params, shared, check = cotool.deal_data(data)
            params['isEnterpriseWx'] = isEnterpriseWx
            if kwargs:
                params = dict(params, **kwargs)
            res = httprequest(url, method, header, params)
            cotool.extract_variable(res, shared)
            cotool.assert_res(res, check)
            return res
Esempio n. 4
0
 def editor_flow(self,
                 plan_name=None,
                 gather_type=1,
                 ad_type=1,
                 channel_id=4,
                 channel_name='知乎'):
     """
     广告计划--流量-编辑 (需要一个没有创建创意的计划才能编辑)
     :param plan_name: 计划名称
     :param channel_name: 投放渠道名称,要与下面channel_ID对应
     :param channel_id: 投放渠道 1,广点通 2,今日头条 3,哔哩哔哩 4,知乎 5,微博...
     :param ad_type: 广告类型,1,信息流 2,竞价
     :param gather_type: 1,手机流量 2,qq流量 3,微信流量
     :return:
     """
     data = self._data.get('editor_flow')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['name'] = plan_name
     params['id'] = GLOBAL_VAR['adId']
     params['gatherType'] = gather_type
     params['channelId'] = channel_id
     params['type'] = ad_type
     params['channelName'] = channel_name
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 5
0
 def put_record_query(self):
     """
     入库记录流量数据查询
     """
     data = self._data.get('query_put_flow_data')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 6
0
 def create_wc_ad_plan_for_model(self, put_model=1, channelId=4):
     data = self._data.get('create_wechat_ad_plant')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['putMode'] = put_model
     params['channelId'] = channelId
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 7
0
 def login_operation(self):
     '''
     登录运营后台
     '''
     url, method, header, params, shared, check = cotool.deal_data(
         self._data['login_operation'])
     header['cookie'] = self.cookie
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 8
0
 def ad_idea_flow_data_query(self):
     """
     广告创意流量数据查询
     """
     data = self._data.get('query_ad_ideas_data')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 9
0
 def create_personal_wechat_ad_ideas(self):
     """
     创建个人微信广告创意
     """
     data = self._data.get('create_personal_wechat_ad_ideas')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 10
0
 def create_wc_ad_plan_for_reception(self):
     """
     创建微信广告计划-直线下发,接待投放模式
     """
     data = self._data.get('create_wechat_ad_plant_for_reception')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 11
0
 def register_code(self):
     '''
     获取注册验证码
     '''
     self.login_operation()
     url, method, header, params, shared, check = cotool.deal_data(
         self._data['register_code'])
     header['cookie'] = self.cookie
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 12
0
 def create_qq_idea(self):
     '''
     创建QQ广告创意
     :return:
     '''
     data = self._data.get('create_qq_ad_ideas')
     url, method, header, params, shared, check = cotool.deal_data(data)
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 13
0
 def get_plan_id(self, gatherType=3):
     """
     获取微信广告计划ID
     """
     data = self._data.get('get_plan_id')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['gatherType'] = gatherType
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 14
0
 def import_budget_error_data(self, file_name):
     '''
     导入异常投放预算数据
     '''
     data = self._data.get('import_budget_error_data')
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_others_file(file_name, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 15
0
 def del_ad_data(self, gatherType=1):
     '''
     删除广告数据
     :return:
     '''
     data = self._data.get('del_ad_data')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['gatherType'] = gatherType
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 16
0
 def creativity_pageList(self):
     '''
     广告创意查询
     :return:
     '''
     data = self._cct.get('creativity_pageList')
     url, method, header, params, shared, check = cotool.deal_data(data)
     token = login.login_action('t0383212689', '123456')
     header['token'] = token
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 17
0
 def add_ad_plan(self):
     '''
     创建广告计划
     :return:
     '''
     data = self._cad.get('program_info_save')
     url, method, header, params, shared, check = cotool.deal_data(data)
     token = login.login_action('t0383212689', '123456')
     header['token'] = token
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 18
0
 def export_idea_flow(self, gather_type=1):
     """
     广告计划--流量-导出
     :param gather_type: 1,手机流量 2,qq流量 3,微信流量
     :return:
     """
     data = self._data.get('export_idea_flow')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['gatherType'] = gather_type
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 19
0
 def import_wx_batch_reception(self, excel):
     '''
     批量导入微信广告流量数据,接待投放模式
     :return:
     '''
     data = self._data['import_wx_batch_reception']
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
Esempio n. 20
0
 def flow_cost_mgt_import(self, excel):
     """
     :param excel: excel文件头组成的list
     :return:
     """
     data = self._data.get('flow_cost_mgt_import')
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
Esempio n. 21
0
 def import_qq_single(self, excel):
     '''
     导入qq单个广告流量数据
     :return:
     '''
     data = self._data['import_qq_single']
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
Esempio n. 22
0
 def create_ad_idea(self, gatherType=1):
     '''
     创建广告创意
     :param gatherType: 流量类型 1,手机流量 2,QQ流量 3,微信流量
     :return:
     '''
     data = self._data.get('create_ad_ideas')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['gatherType'] = gatherType
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 23
0
 def get_ad_data_id(self, gatherType=1):
     '''
     获取广告数据id
     :param gatherType: 流量类型 1,手机流量,2,QQ流量 3,微信流量
     :return:
     '''
     self._data = get_data.get_yinhe_data('ad_module/ad_idea.yaml')
     ad_data = self._data.get('get_ad_data_id')
     url, method, header, params, shared, check = cotool.deal_data(ad_data)
     params['gatherType'] = gatherType
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 24
0
 def import_public_account(self, excel):
     """
     批量导入公众号
     :param excel: 需要导入的excel数据
     :return:
     """
     data = self._data['import_public_account']
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
Esempio n. 25
0
 def send_consumer_single(self):
     '''
     录入手机单个广告消费数据接口
     :return:
     '''
     data = self._data['import_consumer_single']
     url, method, header, params, shared, check = cotool.deal_data(data)
     token = login.login_action('t0383212689', '123456')
     header['token'] = token
     params['costDate'] = const.todayStartTimestamp
     # res = requests.post(url=url, headers=headers_from_data, data=file_data, verify=False).json()
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 26
0
 def add_carrier(self, type=None, carrierNo=None):
     """
     新增载体
     :param type: 1.微信载体   2.QQ群载体   3.企业微信载体
     :return:
     """
     data = self._data.get('add_carrier')
     url, method, header, params, shared, check = cotool.deal_data(data)
     if type:
         params['carriers'][0]['type'] = type
     if carrierNo:
         params['carriers'][0]['carrierNo'] = carrierNo
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 27
0
 def create_ad_plan(self, gatherType=3, allocInstType=3, putMode=1):
     '''
     创建广告计划
     :param gatherType: 流量类型 1,手机流量 2,QQ流量 3,微信流量
     :param allocInstType: 分配模式,不同流量类型,对应分配模式不一致
     :return:
     '''
     data = self._data.get('create_wechat_ad_plant')
     # cotool.quick_request(data, **kwargs)
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['gatherType'] = gatherType
     params['allocInstType'] = allocInstType
     params['putMode'] = putMode
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 28
0
 def flow_cost_mgt_import_others(self, file_name, status, msg):
     """
     :param file_name: 文件名
     :param status: 响应状态码
     :param msg: 返回信息
     :return:
     """
     data = self._data.get('flow_cost_mgt_import')
     url, method, header, params, shared, check = cotool.deal_data(data)
     file_data, content_type, file_path = oe.send_others_file(
         file_name, params)
     header['content-type'] = content_type
     check['status'] = status
     check['msg'] = msg
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
Esempio n. 29
0
 def editor_wechat_idea_flow(self, name=None, gather_type=3, remark=None):
     """
     广告创意--微信流量-编辑 (需要一个没有消费记录的创意才能编辑)
     :param remark: 备注
     :param name: 计划名称
     :param gather_type: 1,手机流量 2,qq流量 3,微信流量
     :return:
     """
     data = self._data.get('editor_wechat_idea_flow')
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['name'] = name
     params['remark'] = remark
     params['gatherType'] = gather_type
     res = httprequest(url, method, header, params)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     return res
Esempio n. 30
0
 def import_mobile_single(self,
                          excel,
                          adNo='93994a6c5fa84e9699d68b5c0c467f5b'):
     '''
     导入手机单个广告流量数据
     :return:
     '''
     data = self._data['import_mobile_single']
     url, method, header, params, shared, check = cotool.deal_data(data)
     params['adNo'] = adNo
     file_data, content_type, file_path = oe.send_file(excel, params)
     header['content-type'] = content_type
     res = httprequest(url, method, header, file_data)
     cotool.extract_variable(res, shared)
     cotool.assert_res(res, check)
     oe.delete(file_path)
     return res