Skip to content

Commit

Permalink
fix #3: broken sample usage in README
Browse files Browse the repository at this point in the history
  • Loading branch information
evilkost committed Apr 13, 2011
1 parent 4170e93 commit f98f7ff
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
brükva
========

Asynchronous [Redis](http://redis-db.com/) client that works within [Tornado](http://tornadoweb.org/) IO loop.
Asynchronous [Redis](http://redis.io/) client that works within [Tornado](http://tornadoweb.org/) IO loop.


Usage
-----

>>> import brukva
>>> c = brukva.Client()
>>> c.connect()
>>> def on_result(result):
(error, data) = result
print data or error
>>> c.set('foo', 'bar', on_result)
>>> c.get('foo', on_result)
>>> c.hgetall('foo', on_result)
>>> c.connection._stream.io_loop.start() # start tornado mainloop
Input:
import logging
logging.basicConfig()
import brukva
c = brukva.Client()
c.connect()
def on_result(result):
print result
c.set('foo', 'bar', on_result)
c.get('foo', on_result)
c.hgetall('foo', on_result)
c.connection._stream.io_loop.start() # start tornado mainloop

Output:
True
bar
ERROR:brukva.client:ResponseError (on HGETALL [('foo',), {}]): Operation against a key holding the wrong kind of value
ResponseError (on HGETALL [('foo',), {}]): Operation against a key holding the wrong kind of value


Tips on testing
---------------

Run tests with the following command:

nosetests -s -w tests --nologcapture
./run_nose.sh


Credits
Expand Down

0 comments on commit f98f7ff

Please sign in to comment.