예제 #1
0
def old_ip(dns_record_id):
    request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    request.set_RecordId(dns_record_id)  # 设置记录值
    request.set_accept_format(rc_format)  # 设置返回格式
    result = clt.do_action_with_exception(request)  # 发送请求内容
    result = JSONDecoder().decode(result)  # 接受返回数据
    return result['Value']  # 返回记录数值
예제 #2
0
파일: ddns.py 프로젝트: dog2cat/aliddns
def getCurrentIP():
    request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    request.set_RecordId(RECORD_ID)
    request.set_accept_format('json')
    response = clt.do_action(request)
    printLog(response)
    return json.loads(response)['Value']
예제 #3
0
 def get_dns_ip(self, record):
     '''print the log'''
     request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest(
     )
     request.set_RecordId(record)
     response = self._client.do_action_with_exception(request)
     logger.log(response)
     return json.loads(response)['Value']
예제 #4
0
 def get_dns_status(self, recordId):
     request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest(
     )
     request.set_accept_format("json")
     request.set_RecordId(recordId)
     result = json.loads(self.clt.do_action(request))
     print(result)
     return result
예제 #5
0
def old_ip():
    clt = client.AcsClient(access_key_id, access_key_secret, 'cn-beijing')
    request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    request.set_RecordId(rc_record_id)
    request.set_accept_format(rc_format)
    result = clt.do_action_with_exception(request)
    result = json.JSONDecoder().decode(result)
    result = result['Value']
    return result
예제 #6
0
def old_ip(rc_record_id):
    clt = client.AcsClient(accessKeyId, accessKeySecret, aliyun_endpoint)
    request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    request.set_RecordId(rc_record_id)
    request.set_accept_format('json')
    result = clt.do_action_with_exception(request)
    result = json.JSONDecoder().decode(result.decode())
    result = result['Value']
    return result
예제 #7
0
def get_old_ip(record_id):
    clt = client.AcsClient(access_key_id, access_key_secret, 'cn-hangzhou')
    request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    request.set_RecordId(record_id)
    request.set_accept_format(rc_format)
    result = clt.do_action(request)
    result = json.JSONDecoder().decode(result.decode('utf-8'))
    result = result['Value']
    return result
예제 #8
0
 def old_ip(self):
     clt = client.AcsClient(self.access_key_id, self.access_key_secret, 'cn-hangzhou')
     request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
     request.set_RecordId(self.record_id)
     request.set_accept_format('json')
     result = clt.do_action_with_exception(request)
     result = json.JSONDecoder().decode(result)
     result = result['Value']
     self.logger.debug('old_ip {}'.format(result))
     return(result)
예제 #9
0
    def get_txt_record(self, record_id):

        req = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
        req.set_RecordId(record_id)

        resp_str = self.acs_client.do_action_with_exception(req)
        resp_dict = json.loads(resp_str)

        logger.debug("get_txt_record:" + resp_str)

        return resp_dict
예제 #10
0
def describe_domain_record_info(record_id):
    """
    通过record_id获取一条特定记录
    :param record_id:
    :return:
    """
    request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    request.set_RecordId(record_id)
    client = _client()
    result = client.do_action_with_exception(request)
    result_dict = json.loads(result)
    return result_dict
예제 #11
0
def old_ip():
    clt = client.AcsClient(access_key_id, access_Key_secret, 'cn-hangzhou')
    request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    #print result, "-------"
    request.set_RecordId(rc_record_id)
    request.set_accept_format(rc_format)
    #print result, "-------"
    result = clt.do_action(request)
    #print result, "-------"
    result = json.JSONDecoder().decode(result)
    print result
    result = result['Value']
    return result
예제 #12
0
    def __init__(self):
        self.client = client.AcsClient(ACCESS_KEY_ID, ACCESS_KEY_SECRET)

        self.get_old_ip_req = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest(
        )
        self.get_old_ip_req.set_RecordId(RC_RECORD_ID)
        self.get_old_ip_req.set_accept_format("json")

        self.set_new_ip_req = UpdateDomainRecordRequest.UpdateDomainRecordRequest(
        )
        self.set_new_ip_req.set_RR(RC_RR)
        self.set_new_ip_req.set_Type(RC_TYPE)
        self.set_new_ip_req.set_RecordId(RC_RECORD_ID)
        self.set_new_ip_req.set_TTL(RC_TTL)
        self.set_new_ip_req.set_accept_format("json")
예제 #13
0
파일: ddns.py 프로젝트: lmhaoye/pi-jb
def connect_dns():
    cip = ip()
    if not cip:
        return False

    req = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    req.set_RecordId(RID)
    resp = client.do_action_with_exception(req).decode('utf-8')
    update_pi(cip)
    logging.info(cip)
    old = json.loads(resp)
    if cip == old['Value']:
        return True
    else:
        return update_record(cip, old)
예제 #14
0
def get_record_from_id(recordid):
    request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    request.set_RecordId(recordid)
    result = send_request(request)
    return result
예제 #15
0
def descRecord(recordId):
    request = DescribeDomainRecordInfoRequest.DescribeDomainRecordInfoRequest()
    request.set_RecordId(recordId)
    response = client.do_action_with_exception(request)
    return json.loads(response)