""" 更新 """parser=ArgumentParser(description=__description__,epilog=__doc__,formatter_class=RawTextHelpFormatter)parser.add_argument('-v','--version',action='version',version=__version__)parser.add_argument('-c','--config',default="config.json",help="run with config file [配置文件路径]")config_file=parser.parse_args().configget_config(path=config_file)# Dynamicly import the dns module as configurationdns_provider=str(get_config('dns','dnspod').lower())dns=getattr(__import__('dns',fromlist=[dns_provider]),dns_provider)dns.Config.ID=get_config('id')dns.Config.TOKEN=get_config('token')dns.Config.TTL=get_config('ttl')ifget_config('debug'):ip.DEBUG=get_config('debug')basicConfig(level=DEBUG,format='%(asctime)s <%(module)s.%(funcName)s> %(lineno)d@%(pathname)s\n[%(levelname)s] %(message)s')print("DDNS[",__version__,"] run:",os_name,sys.platform)print("Configuration was loaded from <==",path.abspath(config_file))print("="*25,ctime(),"="*25,sep=' ')proxy=get_config('proxy')or'DIRECT'proxy_list=proxy.strip('; ').split(';')cache=get_config('cache',True)andCache(CACHE_FILE)ifcacheisFalse:info("Cache is disabled!")elifget_config.time>=cache.time:warning("Cache file is out of dated.")cache.clear()elifnotcache:debug("Cache is empty.")update_ip('4',cache,dns,proxy_list)update_ip('6',cache,dns,proxy_list)if__name__=='__main__':main()