Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Commit 6e75514

Browse files
committed
update README
1 parent 04d6c0d commit 6e75514

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/cablehead/python-consul.svg?branch=master)](https://travis-ci.org/cablehead/python-consul)[![Coverage Status](https://coveralls.io/repos/cablehead/python-consul/badge.png?branch=master)](https://coveralls.io/r/cablehead/python-consul?branch=master)
44

5-
## Installation
5+
## Install
66

77
```
88
pip install python-consul
@@ -12,7 +12,8 @@
1212

1313
### Standard
1414

15-
```
15+
```python
16+
1617
>>> import consul
1718
>>> c = consul.Consul()
1819
>>> c.kv.put('foo', 'bar')
@@ -23,3 +24,23 @@
2324
>>> index, data = c.kv.get('foo', index=index)
2425
# this will block until there's an update and a timeout
2526
```
27+
28+
### Tornado
29+
30+
Poll a key for updates
31+
32+
```python
33+
34+
import consul.tornado
35+
36+
c = consul.tornado.Consul()
37+
38+
@tornado.gen.coroutine
39+
def watch():
40+
index = None
41+
while True:
42+
index, data = yield c.kv.get('foo', index=index)
43+
print data['Value']
44+
45+
loop.add_callback(watch)
46+
```

0 commit comments

Comments
 (0)