python实现dnspod自动更新dns解析的方法
(编辑:jimmy 日期: 2024/11/17 浏览:3 次 )
复制代码 代码如下:
def ddns():
"""
用当前ip更新ddns
"""
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/json"}
conn = httplib.HTTPSConnection("dnsapi.cn", timeout=30)
conn.request("POST", "/Record.Ddns", urllib.urlencode(ddns_params), headers)
response = conn.getresponse()
# print response.status, response.reason
# data = response.read()
# print data
conn.close()
return response.status == 200
def ddns():
"""
用当前ip更新ddns
"""
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/json"}
conn = httplib.HTTPSConnection("dnsapi.cn", timeout=30)
conn.request("POST", "/Record.Ddns", urllib.urlencode(ddns_params), headers)
response = conn.getresponse()
# print response.status, response.reason
# data = response.read()
# print data
conn.close()
return response.status == 200
下一篇:python转换摩斯密码示例