python-consul icon indicating copy to clipboard operation
python-consul copied to clipboard

AttributeError: 'Agent' object has no attribute 'token'

Open gasabr opened this issue 6 years ago • 3 comments

c = consul.Consul()
new_service = consul.Consul.Agent.Service(c.agent)
new_service.register(config['executor_id'])

Probably, I'm not using the Service correctly here, but still this code causes error in this line this line

gasabr avatar Sep 17 '19 10:09 gasabr

My bad, after reading the code I have realized that agent variable is not consul.Consul.Agent, but consul.Consul.

gasabr avatar Sep 17 '19 11:09 gasabr

@gasabr python-consul2 The author may be a little busy, I will maintain a version, welcome to use. The new consul version was used. Progressively implement all API interfaces in the future

poppyred avatar Oct 09 '19 07:10 poppyred

@gasabr you maby use like under

 c = consul.Consul(port=acl_consul.port, token=acl_consul.token)
c.agent.service.register('service_name')

poppyred avatar Oct 09 '19 09:10 poppyred