Python implementation of dnspod automatically update DNS resolution method

  • 2020-04-02 13:23:29
  • OfStack


def ddns():
"""
 With the current ip update 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

Related articles: