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 hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page