Skip to main content

python sdk for nacos

Project description

xadnacos

https://img.shields.io/pypi/v/xadnacos.svg https://img.shields.io/travis/KONE-XAD/xadnacos.svg Documentation Status

xadnacos是一个用来调用naccos的sdk, 基于KcangNacos进行修改

参考: * https://github.com/KcangYan/nacos-python-sdk.git

  • Free software: MIT license

文档

导入dkimageapp库:

from xadnacos import xadnacos as nacos

创建nacos连接对象:

nacosServer = nacos.nacos(ip=nacosIp,port=nacosPort)

将本地配置注入到nacos对象中即可获取远程配置:

GlobalConfig={}
nacosServer.config(dataId="demo-python.json",group="dev",tenant="python",myConfig=GlobalConfig)

注册nacos服务:

serverHost = socket.gethostbyname(socket.gethostname())
metadata = {
    "tier": "backend",
    "projectid": "THID89782455-HJ45678963"
}
clusterName = myConfig.region

nacosServer.registerService(serviceIp=serverHost,servicePort=myConfig.port,serviceName="python-provider",
                            namespaceId="python",groupName="dev",clusterName=clusterName,metadata=metadata)

开启监听配置线程和服务注册心跳进程的健康检查进程:

nacosServer.healthyCheck()

Features

  • TODO

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2023-02-04)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xadnacos-0.1.3.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distribution

xadnacos-0.1.3-py2.py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page