Nacos sdk for python
Project description
pynacos-sdk
Install
pip install pynacos-sdk
Tutorial
from nacos import Nacos
from nacos.errors import RequestError, ParamError
from nacos.params import ServiceRegisterParam, ServiceListParam
NACOS_HOST = "127.0.0.1"
NACOS_PORT = 8848
NAMESPACE_ID = "e26e7439-e161-4709-8778-ab5ecef5fec5"
nacos = Nacos(NACOS_HOST, NACOS_PORT, NAMESPACE_ID)
try:
param = ServiceRegisterParam("hello")
status = nacos.service_register(param)
print("register status = ", status)
except ParamError as e:
print("param error")
print(e)
except RequestError as e:
print("nacos error")
print(e)
try:
param = ServiceListParam()
services = nacos.service_list(param)
print(services.json())
except ParamError as e:
print("param error")
print(e)
except RequestError as e:
print("nacos error")
print(e)
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
pynacos-sdk-0.3.0.tar.gz
(9.1 kB
view hashes)
Built Distribution
Close
Hashes for pynacos_sdk-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 044210e754cbb1137ec701a85c2b57c20c1b20a6e559ba5a6054893e54c9d8fd |
|
MD5 | 9c90f7228de61288e14856ec9b43deda |
|
BLAKE2b-256 | 12b654a3861aa19f68a3c20f1c86ea6b7123f8fb105e1fe4dbf0c92fad0d92ed |