def pull_status(self, data=None): if not data: data = {} data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_PULL_VOICE_STATUS'], data)
def get_package(self, data=None): if not data: data = {} data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_GET_FLOW_PACKAGE'], data)
def set(self, data=None): if not data: data = {} data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_SET_USER_INFO'], data)
def recharge(self, data=None): if not data: data = {} if 'mobile' not in data: return Result(None, 'mobile 为空') data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_RECHARGE_FLOW'], data)
def delete(self, data=None): if not data: data = {} if 'tpl_id' not in data: return Result(None, 'tpl_id 为空') data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_DEL_TEMPLATE'], data)
def add(self, data=None): if not data: data = {} if 'tpl_content' not in data: return Result(None, 'tpl_content 为空') data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_ADD_TEMPLATE'], data)
def send(self, data=None): if not data: data = {} if 'mobile' not in data: return Result(None, 'mobile 为空') if 'code' not in data: return Result(None, 'code 为空') data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_SEND_VOICE_SMS'], data)
def tpl_batch_send(self, data=None): if not data: data = {} if 'mobile' not in data: return Result(None, 'mobile 为空') if 'tpl_id' not in data: return Result(None, 'tpl_id 为空') if 'tpl_value' not in data: return Result(None, 'tpl_value 为空') data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_SEND_TPL_BATCH_SMS'], data)
def single_send(self, data=None): if not data: data = {} if 'mobile' not in data: return Result(None, 'mobile 为空') if 'text' not in data: return Result(None, 'text 为空') data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_SEND_SINGLE_SMS'], data)
def multi_send(self, data=None): if not data: data = {} if 'mobile' not in data: return Result(None, 'mobile 为空') if 'text' not in data: return Result(None, 'text 为空') data['apikey'] = self.apikey mobile = data['mobile'] text = data['text'] if len(str(mobile).split(',')) != len(str(text).split(',')): return Result(None, 'mobile 与 text 个数不匹配') data['text'] = '' for s in str(text).split(','): data['text'] += urllib.quote(s) + ',' data['text'] = data['text'][0:-1] return request_post(self,yunpian_config['URI_SEND_MULTI_SMS'], data)
def get(self, data=None): if not data: data = {} data['apikey'] = self.apikey return request_post(self,yunpian_config['URI_GET_TEMPLATE'], data)