From 59a989bf9dd70797d0134f66e71c7edfeaece910 Mon Sep 17 00:00:00 2001 From: NewFuture Date: Sat, 3 Dec 2016 23:03:37 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dns/__init__.py | 0 alidns.py => dns/alidns.py | 4 +++- debug.py => dns/debug.py | 0 dnspod.py => dns/dnspod.py | 4 ++-- run.py | 3 +-- 5 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 dns/__init__.py rename alidns.py => dns/alidns.py (98%) rename debug.py => dns/debug.py (100%) rename dnspod.py => dns/dnspod.py (98%) diff --git a/dns/__init__.py b/dns/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/alidns.py b/dns/alidns.py similarity index 98% rename from alidns.py rename to dns/alidns.py index 3a66586..2a9e928 100644 --- a/alidns.py +++ b/dns/alidns.py @@ -14,7 +14,7 @@ import urllib import uuid from datetime import datetime -import debug +import dns.debug as debug __author__ = 'New Future' # __all__ = ["request", "ID", "TOKEN", "PROXY"] @@ -150,6 +150,8 @@ def update_record(domain, value, record_type='A'): result[rid] = res else: result[rid] = "update fail!\n" + str(res) + else: + result[rid] = domain else: # https://help.aliyun.com/document_detail/29772.html res = request(Action="AddDomainRecord", DomainName=main, Value=value, RR=sub, Type=record_type) diff --git a/debug.py b/dns/debug.py similarity index 100% rename from debug.py rename to dns/debug.py diff --git a/dnspod.py b/dns/dnspod.py similarity index 98% rename from dnspod.py rename to dns/dnspod.py index 57a39ef..c789576 100644 --- a/dnspod.py +++ b/dns/dnspod.py @@ -11,7 +11,7 @@ import httplib import json import urllib -import debug +import dns.debug as debug __author__ = 'New Future' @@ -147,7 +147,7 @@ def update_record(domain, value, record_type="A"): if record["value"] != value: DEBUG(sub, record) res = request('Record.Modify', record_id=did, record_line=record["line"].encode( - "utf-8"), value=value, sub_domain=sub, domain_id=domainid, record_type=record_type, ttl=600) + "utf-8"), value=value, sub_domain=sub, domain_id=domainid, record_type=record_type) if res: get_records.records[domainid][did]["value"] = value result[did] = res.get("record") diff --git a/run.py b/run.py index acb8850..553d3e9 100755 --- a/run.py +++ b/run.py @@ -8,9 +8,8 @@ import argparse import json import time -import dnspod -import alidns import ip +from dns import alidns, dnspod DNS = dnspod