Nacos引擎Python客户端接入文档 支持的Python版本 Python 2.7 Python 3.6 Python 3.7 Nacos服务端版本 Nacos 2.x 安装依赖 shell pip install nacossdkpython 开始使用 import nacos SERVERADDRESSES "server addresses split by comma" NAMESPACE "namespace id" no auth mode client nacos.NacosClient(SERVERADDRESSES, namespaceNAMESPACE) auth mode client nacos.NacosClient(SERVERADDRESSES, namespaceNAMESPACE, ak"{ak}", sk"{sk}") get config dataid "config.nacos" group "group" print(client.getconfig(dataid, group)) 配置中心 创建客户端 client NacosClient(serveraddresses, namespaceyourns, usernamename, passwordyourpwd) 参数说明 serveraddresses required Nacos server address, comma separated if more than 1. namespace Namespace. default: None username The username to authenticate. default: null password The password to authentication. default: null loglevel Log level. default: null logrotationbackupcount The number of log files to keep. default: 7 其他参数可以按如下方式设置 client.setoptions({key}{value}) defaulttimeout Default timeout for get config from server in seconds. pullingtimeout Long polling timeout in seconds. pullingconfigsize Max config items number listened by one polling process. callbackthreadnum Concurrency for invoking callback. failoverbase Dir to store failover config files. snapshotbase Dir to store snapshot config files. nosnapshot To disable default snapshot behavior, this can be overridden by param nosnapshot in get method. proxies Dict proxy mapping, some environments require proxy access, so you can set this parameter, this way http requests go through the proxy. API 参考