domain = "YourDomain"
passwd = "YourPasswd"
import os, urllib2
import logging
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s | %(name)s | %(levelname)s | %(message)s",
filename=os.path.join(os.path.dirname(__file__),'log.txt'),
)
logging.info("Starting script...")
logging.debug("Getting global IP...")
ip_address = urllib2.urlopen("http://info.ddo.jp/remote_addr.php").read().split(":")[1]
logging.debug("Global IP: "+ip_address)
logging.debug("Updating global IP...")
result = urllib2.urlopen("http://free.ddo.jp/dnsupdate.php?dn=%s&ip=%s&pw=%s"%(domain,ip_address,passwd)).read()
logging.debug(result.decode("EUC-JP"))
logging.info("Endded script...")