|
1 |
| -RedisJSON Python Client |
2 |
| -==================== |
| 1 | +[](https://github.com/RedisJSON/redisjson-py/blob/master/LICENSE) |
| 2 | +[](https://circleci.com/gh/RedisJSON/redisjson-py/tree/master) |
| 3 | +[](https://badge.fury.io/py/rejson) |
| 4 | +[](https://github.com/RedisJSON/redisjson-py) |
| 5 | +[](https://github.com/RedisJSON/redisjson-py/releases/latest) |
| 6 | +[](https://coveralls.io/github/RedisLabs/rejson-py?branch=master) |
3 | 7 |
|
4 |
| -.. image:: https://img.shields.io/github/license/RedisJSON/RedisJSON-py.svg |
5 |
| - :target: https://github.com/RedisJSON/redisjson-py/blob/master/LICENSE |
6 |
| - |
7 |
| -.. image:: https://circleci.com/gh/RedisJSON/redisjson-py/tree/master.svg?style=svg |
8 |
| - :target: https://circleci.com/gh/RedisJSON/redisjson-py/tree/master |
9 |
| - |
10 |
| -.. image:: https://badge.fury.io/py/rejson.svg |
11 |
| - :target: https://badge.fury.io/py/rejson |
12 |
| - |
13 |
| -.. image:: https://img.shields.io/pypi/pyversions/rejson.svg |
14 |
| - :target: https://github.com/RedisJSON/redisjson-py |
15 |
| - |
16 |
| -.. image:: https://img.shields.io/github/release/RedisJSON/redisjson-py.svg |
17 |
| - :target: https://github.com/RedisJSON/redisjson-py/releases/latest |
| 8 | +# RedisJSON Python Client |
18 | 9 |
|
19 |
| -.. image:: https://coveralls.io/repos/github/RedisLabs/rejson-py/badge.svg?branch=master |
20 |
| - :target: https://coveralls.io/github/RedisLabs/rejson-py?branch=master |
| 10 | +[](https://groups.google.com/forum/#!forum/redisjson) |
| 11 | +[](https://gitter.im/RedisLabs/RedisJSON?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) |
21 | 12 |
|
22 | 13 | rejson-py is a package that allows storing, updating and querying objects as
|
23 |
| -JSON documents in a `Redis`_ database that is extended with the |
24 |
| -`ReJSON module`_. The package extends |
25 |
| -`redis-py`_'s interface with ReJSON's |
| 14 | +JSON documents in a [Redis](https://redis.io) database that is extended with the |
| 15 | +[ReJSON module](https://github.com/redislabsmodules/rejson). The package extends |
| 16 | +[redis-py](https://github.com/andymccurdy/redis-py)'s interface with ReJSON's |
26 | 17 | API, and performs on-the-fly serialization/deserialization of objects to/from
|
27 | 18 | JSON.
|
28 | 19 |
|
29 |
| -.. _`Redis`: https://redis.io |
30 |
| -.. _`ReJSON module`: https://github.com/redislabsmodules/rejson |
31 |
| -.. _`redis-py`: https://github.com/andymccurdy/redis-py |
32 |
| - |
33 |
| -Installation |
34 |
| ------------- |
35 |
| - |
36 |
| -.. code-block:: bash |
37 |
| -
|
38 |
| - $ pip install rejson |
| 20 | +## Installation |
39 | 21 |
|
40 |
| -Usage example |
41 |
| -------------- |
| 22 | +```bash |
| 23 | +$ pip install rejson |
| 24 | +``` |
42 | 25 |
|
43 |
| -.. code-block:: python |
| 26 | +## Usage example |
44 | 27 |
|
| 28 | +```python |
45 | 29 | from rejson import Client, Path
|
46 | 30 |
|
47 | 31 | rj = Client(host='localhost', port=6379, decode_responses=True)
|
@@ -81,23 +65,19 @@ Usage example
|
81 | 65 | }
|
82 | 66 | rj.jsonset('non-ascii', Path.rootPath(), obj_non_ascii)
|
83 | 67 | print '{} is a non-ascii string'.format(rj.jsonget('non-ascii', Path('.non_ascii_string'), no_escape=True))
|
| 68 | +``` |
84 | 69 |
|
85 |
| -Encoding/Decoding |
86 |
| ------------------ |
| 70 | +## Encoding/Decoding |
87 | 71 |
|
88 |
| -rejson-py uses Python's json_. |
| 72 | +rejson-py uses Python's (json)[https://docs.python.org/2/library/json.html]. |
89 | 73 | The client can be set to use custom encoders/decoders at creation, or by calling
|
90 |
| -explicitly the setEncoder_ () and |
91 |
| -setDecoder_ () methods, respectively. |
92 |
| - |
93 |
| -.. _json: https://docs.python.org/2/library/json.html |
94 |
| -.. _setDecoder: ./API.md#setdecoder |
95 |
| -.. _setEncoder: ./API.md#setencoder |
| 74 | +explicitly the [setEncoder()](./API.md#setencoder) and |
| 75 | +[setDecoder()](./API.md#setencoder) methods, respectively. |
96 | 76 |
|
97 | 77 | The following shows how to use this for a custom class that's stored as
|
98 | 78 | a JSON string for example:
|
99 | 79 |
|
100 |
| -.. code-block:: python |
| 80 | +```python |
101 | 81 |
|
102 | 82 | from json import JSONEncoder, JSONDecoder
|
103 | 83 | from rejson import Client
|
@@ -149,28 +129,21 @@ a JSON string for example:
|
149 | 129 |
|
150 | 130 | # Retrieve it
|
151 | 131 | obj = rj.jsonget('custom', Path.rootPath())
|
| 132 | +``` |
152 | 133 |
|
153 |
| -
|
154 |
| -API |
155 |
| ---- |
| 134 | +## API |
156 | 135 |
|
157 | 136 | As rejson-py exposes the same methods as redis-py, it can be used as a drop-in
|
158 | 137 | replacement. On top of Redis' core commands, the client also adds ReJSON's
|
159 | 138 | vocabulary and a couple of helper methods. These are documented in the
|
160 | 139 | [API.md](API.md) file, which can be generated by running:
|
161 | 140 |
|
162 |
| -.. code-block:: bash |
163 |
| -
|
164 |
| - $ python gendoc rejson > API.md |
165 |
| -
|
166 |
| -
|
167 |
| -For complete documentation about ReJSON's commands, refer to `ReJSON's website`_. |
168 |
| - |
169 |
| -.. _`ReJSON's website`: http://rejson.io |
| 141 | +```bash |
| 142 | +$ python gendoc rejson > API.md |
| 143 | +``` |
170 | 144 |
|
171 |
| -License |
172 |
| -------- |
| 145 | +For complete documentation about ReJSON's commands, refer to [ReJSON's website](http://rejson.io). |
173 | 146 |
|
174 |
| -`BSD 2-Clause`_ |
| 147 | +## License |
175 | 148 |
|
176 |
| -.. _`BSD 2-Clause`: https://github.com/RedisLabs/rejson-py/blob/master/LICENSE |
| 149 | +[BSD 2-Clause](https://github.com/RedisLabs/rejson-py/blob/master/LICENSE) |
0 commit comments