Skip to main content

Nacos sdk for python

Project description

pynacos-sdk

pypi Codacy Badge

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.4.1.tar.gz (9.2 kB view hashes)

Uploaded Source

Built Distribution

pynacos_sdk-0.4.1-py3-none-any.whl (9.4 kB view hashes)

Uploaded 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