-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
132 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ Client API | |
|
||
.. autoclass:: Client | ||
:members: | ||
:inherited-members: | ||
:show-inheritance: | ||
|
||
.. automethod:: __init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
.. tornadis documentation master file, created by | ||
sphinx-quickstart on Tue Sep 9 21:29:37 2014. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
.. title:: Tornadis library | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
quickstart | ||
introduction | ||
api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Quickstart | ||
========== | ||
|
||
Requirements | ||
------------ | ||
|
||
- Python 2.7 or Python >= 3.2 | ||
- unix operating system (linux, osx...) | ||
- a running redis server (>= 2.0) | ||
|
||
Installation | ||
------------ | ||
|
||
With pip_ (without pip see at then end of this document):: | ||
|
||
pip install tornadis | ||
|
||
First try | ||
--------- | ||
|
||
.. literalinclude:: ../examples/coroutines.py | ||
:language: python | ||
:linenos: | ||
|
||
Installation without pip | ||
------------------------ | ||
|
||
- install tornado_ >= 4.2 | ||
- install `python wrapper for hiredis`_ | ||
- install six_ | ||
- download and uncompress a `tornadis release`_ | ||
- run ``python setup.py install`` in the tornadis directory | ||
|
||
|
||
.. _pip : https://pypi.python.org/pypi/pip | ||
.. _tornado: http://www.tornadoweb.org/ | ||
.. _python wrapper for hiredis: https://github.com/redis/hiredis-py | ||
.. _six: https://pythonhosted.org/six/ | ||
.. _tornadis release: https://github.com/thefab/tornadis/releases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
# Let's import tornado and tornadis | ||
import tornado | ||
import tornadis | ||
import logging | ||
logging.basicConfig(level=logging.CRITICAL) | ||
|
||
|
||
@tornado.gen.coroutine | ||
def talk_to_redis(): | ||
# let's (re)connect (autoconnect mode), call the ping redis command | ||
# and wait the reply without blocking the tornado ioloop | ||
result = yield client.call("PING") | ||
if not isinstance(result, tornadis.TornadisException): | ||
if isinstance(result, tornadis.TornadisException): | ||
# For specific reasons, tornadis nearly never raises any exception | ||
# they are returned as result | ||
print "got exception: %s" % result | ||
else: | ||
# result is already a python object (a string in this simple example) | ||
print "Result: %s" % result | ||
|
||
|
||
# Build a tornadis.Client object with some options as kwargs | ||
# host: redis host to connect | ||
# port: redis port to connect | ||
# autoconnect=True: put the Client object in auto(re)connect mode | ||
client = tornadis.Client(host="localhost", port=6379, autoconnect=True) | ||
|
||
# Start a tornado IOLoop, execute the coroutine and end the program | ||
loop = tornado.ioloop.IOLoop.instance() | ||
client = tornadis.Client() | ||
loop.run_sync(talk_to_redis) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters