欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

python实现dnspod自动更新dns解析的方法

程序员文章站 2023-01-04 17:07:18
复制代码 代码如下:def ddns():"""用当前ip更新ddns"""headers = {"content-type": "application/x-www-fo...
复制代码 代码如下:

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