Skip to main content

consul服务注册与获取

Project description

Introduce to qb-consul

version: 1.0.2

how to install:

pip install qb-consul

If you want to use it locally:

from qb_consul import Consul


host = "127.0.0.1"  # consul服务器的ip
port = 8500  # consul服务器对外的端口
consul_client = Consul(host, port)

# register service
name = "qbzz-server"
host1 = "127.0.0.1"
port1 = 8001
service_id = "qbzz-server-%s" % port1
consul_client.register_service(name, service_id, host1, port1)

# get service
message = consul_client.get_service('qbzz-server')
host = message[0]
port = message[1]



Project details


Download files

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

Files for qb-consul, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size qb-consul-1.0.2.tar.gz (1.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page