香草蟒蛇领事馆客户端

vanilla.consul的Python项目详细描述


这是基于python-consul库的Vanilla的适配器/插件。

用法与standard API相同,只是所有api调用都返回 香草烟斗,可以recv'打开以接收consur响应。

示例

h=vanilla.Hub()c=h.consul()classConfig(object):passconfig=Config()@h.spawndefmonitor():# register our servicec.agent.service.register('foo',service_id='foo:1',ttl='10s').recv()@h.spawndefkeepalive():whileTrue:# ping our service's health check every 5sc.health.check.ttl_pass('service:foo:1').recv()h.sleep(5000)# maintain our internal configuration state with all available nodes# providing the foo serviceindex=NonewhileTrue:index,nodes=c.health.service('foo',index=index,passing=True).recv()config.nodes=[node['Service']['ID']fornodeinnodes]# make use of config.nodes

安装

pip install vanilla.consul

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带Maven的Eclipse Java存储库:缺少工件:compile   java如何以编程方式停止RMI服务器并通知所有客户端   java Roboguice抛出ClassNotFoundException:AnnotationDatabaseImpl   java为什么lucene 4.0删除IndexWriter类的两个构造函数?   nls如何避免java项目上不需要的日志消息?   测试无法在Selenium Webdriver(java)中定位iframe   使用XML的java servlet   java如何使用jxl用****屏蔽单元格   java使用SQLite从数据库中选择“没有这样的列”   导入扫描程序后出现java编译错误   插入查询的java空指针异常   使用创建PostgreSQL数据库。Java应用中的sql脚本   java使用jsoup将HTML解析为格式化的明文