def record_list(self, offset=0, length=2000, sub_domain=None, record_type=None, record_line=None, keyword=None): params = { 'domain': self.name, 'offset': offset, 'length': length, 'keyword': keyword, 'sub_domain': sub_domain, 'record_type': record_type, 'record_line': record_line, } params = util.remove_none(params) json_data = util.http_post('Record.List', self.user.login_token, params) record_list = [] for item in json_data['records']: record_list.append( Record(self.user, self, item['name'], item['type'], item['value'], item['line'], item['ttl'], item['mx'], item['id'], item['status'])) return record_list, json_data
def remove(self): params = { 'domain': self.domain.name, 'record_id': self.r_id, } params = util.remove_none(params) json_data = util.http_post('Record.Remove', self.user.login_token, params) return self, json_data
def info(self, r_id): self.r_id = r_id params = { 'domain': self.domain.name, 'record_id': self.r_id, } params = util.remove_none(params) json_data = util.http_post('Record.Info', self.user.login_token, params) self.mx = json_data['mx'] self.ttl = json_data['ttl'] self.name = json_data['name'] self.line = json_data['line'] self.r_type = json_data['type'] self.value = json_data['value'] self.status = json_data['status'] return self, json_data
def domain_list(self, offset=0, length=50, domain_type=None, group_id=None, keyword=None): params = { 'offset': offset, 'length': length, 'domain_type': domain_type, 'group_id': group_id, 'keyword': keyword, } params = util.remove_none(params) json_data = util.http_post('Domain.List', self.login_token, params) domain_list = [] for item in json_data['domains']: domain_list.append(Domain(self, item['punycode'])) return domain_list, json_data
def version(self): json_data = util.http_post('Info.Version', self.login_token, {}) return json_data['status']['message'], json_data
def modify(self): params = self.detail() params = util.remove_none(params) json_data = util.http_post('Record.Modify', self.user.login_token, params) return self, json_data