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.

Source Distribution

qb-consul-1.0.2.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file qb-consul-1.0.2.tar.gz.

File metadata

  • Download URL: qb-consul-1.0.2.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.4

File hashes

Hashes for qb-consul-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e0cbc8ebbf16976bd23ce17bc61a5d9dc77e6036f67000a600b4054adac952af
MD5 eee2a4d17f9562570c8a17e4994a3ae3
BLAKE2b-256 be625e9eff4773b415742e833c2afcc5627147f1f8dce4a78278b9632688f779

See more details on using hashes here.

Supported by

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