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)
def import_budget_data(self, excel): ''' 导入投放预算数据 ''' data = self._data.get('import_budget_data') 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)
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)
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)
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)
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)
def import_mobile_unit(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) oe.delete(file_path) return res
def import_qq_flow_not_free(self): """ 导入(QQ流量)--拥有【免费流量组】 """ data = self._data.get('student_input_import_for_qq_not_free') url, method, header, params, shared, check = cotool.deal_data(data) excel = { "1": ['客户姓名', '手机号码', 'QQ号码', '微信号', 'QQ群'], "2": ['lily', '13012345678', '23121231', '123456', '123456'] } 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 res = httprequest(url, method, header, file_data) cotool.extract_variable(res, shared) cotool.assert_res(res, check) oe.delete(file_path)
def imp_phone_flow_free(self, subjectId='280', subjectName='PHP'): """ 导入(手机流量)--拥有【免费流量组】 :param subjectId: 科目id :param subjectName: 科目名称 """ phone = const.phoneNumber data = self._data.get('student_input_import_for_phone_free') url, method, header, params, shared, check = cotool.deal_data(data) params['subjectId'] = subjectId params['subjectName'] = subjectName excel = { "1": ['客户姓名', '手机号码', 'QQ号码', '微信号', 'QQ群'], "2": ['lily', phone, '23121231', '123456', '123456'] } file_data, content_type, file_path = oe.send_file(excel, params) header['content-type'] = content_type res = httprequest(url, method, header, file_data) print(res) cotool.extract_variable(res, shared) cotool.assert_res(res, check) oe.delete(file_path)
def imp_wx_flow_free(self, subjectId=280, subjectName='PHP'): """ 学员录入--导入(微信流量)--拥有【免费流量组】 :param subjectId: 科目id :param subjectName: 科目名称 """ phone = const.phoneNumber qq = const.qq data = self._data.get('student_input_import_for_wx_free') url, method, header, params, shared, check = cotool.deal_data(data) excel = { "1": ['客户姓名', '手机号码', 'QQ号码', '微信号', 'QQ群'], "2": ['lily', 'phone', qq, qq, '123456'] } params['subjectId'] = subjectId params['subjectName'] = subjectName 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