Skip to content

Commit

Permalink
Adjust docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bcb committed Sep 29, 2016
1 parent 407b00f commit 3e9efc8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 42 deletions.
8 changes: 2 additions & 6 deletions doc/_static/custom.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
/* Stop headings from appearing as links when 'contents' is used */
h2 a, h2 a:hover {
h2 a, h2 a:hover,
h3 a, h3 a:hover {
color: inherit;
text-decoration: none;
}

#contents {
margin: 0;
padding: 10px 0 10px 50px;
}

#contents ul {
margin: 0;
padding: 0;
}
18 changes: 10 additions & 8 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
jsonrpcclient API
*****************

.. contents::
:local:

Sending a request
=================

Request
=======
-------

.. automethod:: jsonrpcclient.client.Client.request

If you're not interested in a response, use ``notify()`` instead of
``request()``.

Send
====
----

.. automethod:: jsonrpcclient.client.Client.send

Request class
=============

::

from jsonrpcclient import Request
The Request class
=================

.. autoclass:: jsonrpcclient.request.Request

Expand Down
75 changes: 47 additions & 28 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,81 @@ protocols.
.. contents::
:local:

aiohttp
=======

``aiohttpClient`` uses the `aiohttp <http://aiohttp.readthedocs.io/>`__
library::

$ pip install 'jsonrpcclient[aiohttp]'

.. literalinclude:: ../examples/aiohttp_client.py
Synchronous
===========

Requests
========
--------

``HTTPClient`` uses the `Requests <http://docs.python-requests.org/>`__ library.
Uses `requests <http://docs.python-requests.org/>`__.

::
.. code-block:: sh
$ pip install 'jsonrpcclient[requests]'
.. literalinclude:: ../examples/http_client.py

ZeroMQ
------

Uses `pyzmq <https://pyzmq.readthedocs.io/>`__.

.. code-block:: sh
$ pip install 'jsonrpcclient[pyzmq]'
.. literalinclude:: ../examples/zeromq_client.py

See `blog post <https://bcb.github.io/jsonrpc/zeromq>`__.

Asynchronous
============

These require Python 3.5+.

aiohttp
-------

Uses `aiohttp <http://aiohttp.readthedocs.io/>`__.

.. code-block:: sh
$ pip install 'jsonrpcclient[aiohttp]'
.. literalinclude:: ../examples/aiohttp_client.py

See `blog post <https://bcb.github.io/jsonrpc/aiohttp>`__.

Tornado
=======
-------

``TornadoClient`` uses `Tornado <http://www.tornadoweb.org/>`__ to send an
asynchronous request.
Uses `Tornado <http://www.tornadoweb.org/>`__.

::
.. code-block:: sh
$ pip install 'jsonrpcclient[tornado]'
.. literalinclude:: ../examples/tornado_client.py

Note the ``async``/``await`` syntax requires Python 3.5+. Prior to that use
`@gen.coroutine and yield
<http://tornado.readthedocs.io/en/stable/guide/coroutines.html#python-3-5-async-and-await>`__.

See `blog post <https://bcb.github.io/jsonrpc/tornado>`__.

Websockets
==========
----------

Uses `websockets <http://websockets.readthedocs.io/>`__.

``WebSocketsClient`` uses the `websockets <http://websockets.readthedocs.io/>`__
library::
.. code-block:: sh
$ pip install 'jsonrpcclient[aiohttp]'
.. literalinclude:: ../examples/aiohttp_client.py

ZeroMQ
======
ZeroMQ (async)
--------------

``ZeroMQClient`` uses `pyzmq <https://pyzmq.readthedocs.io/>`__ for comms with
a ZeroMQ server.
Uses `pyzmq <https://pyzmq.readthedocs.io/>`__.

::
.. code-block:: sh
$ pip install 'jsonrpcclient[pyzmq]'
Expand Down

0 comments on commit 3e9efc8

Please sign in to comment.