def getDnsApi(dns): if dns == "qCloud": return QcloudApi() elif dns == "aliyun": return AliApi() elif dns == "dnspod": return DnspodApi() return None
info["recordId"] = record["id"] info["value"] = record["value"] cu_info.append(info) if record["line"] == "电信": info = {} info["recordId"] = record["id"] info["value"] = record["value"] ct_info.append(info) for line in lines: if line == "CM": changeDNS("CM", cm_info, temp_cf_cmips, domain, sub_domain, cloud) elif line == "CU": changeDNS("CU", cu_info, temp_cf_cuips, domain, sub_domain, cloud) elif line == "CT": changeDNS("CT", ct_info, temp_cf_ctips, domain, sub_domain, cloud) except Exception as e: print("CHANGE DNS ERROR: ----Time: " + str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + "----MESSAGE: " + str(e)) if __name__ == '__main__': if DNS_SERVER == 1: cloud = QcloudApi(SECRETID, SECRETKEY) elif DNS_SERVER == 2: cloud = AliApi(SECRETID, SECRETKEY) main(cloud)