{ "info": { "author": "RedisLabs", "author_email": "oss@redislabs.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Database" ], "description": "RedisJSON Python Client\n====================\n\n.. image:: https://img.shields.io/github/license/RedisJSON/RedisJSON-py.svg\n :target: https://github.com/RedisJSON/RedisJSON-py-go\n\n.. image:: https://travis-ci.org/RedisLabs/rejson-py.svg?branch=master\n :target: https://travis-ci.org/RedisLabs/rejson-py\n\n.. image:: https://badge.fury.io/py/rejson.svg\n :target: https://badge.fury.io/py/rejson\n\n.. image:: https://img.shields.io/pypi/pyversions/rejson.svg\n :target: https://github.com/RedisJSON/redisjson-py\n \n.. image:: https://img.shields.io/github/release/RedisJSON/redisjson-py.svg\n :target: https://github.com/RedisJSON/redisjson-py/releases/latest\n\n.. image:: https://coveralls.io/repos/github/RedisLabs/rejson-py/badge.svg?branch=master\n :target: https://coveralls.io/github/RedisLabs/rejson-py?branch=master\n \nrejson-py is a package that allows storing, updating and querying objects as\nJSON documents in a `Redis`_ database that is extended with the\n`ReJSON module`_. The package extends\n`redis-py`_'s interface with ReJSON's\nAPI, and performs on-the-fly serialization/deserialization of objects to/from\nJSON.\n\n.. _`Redis`: https://redis.io\n.. _`ReJSON module`: https://github.com/redislabsmodules/rejson\n.. _`redis-py`: https://github.com/andymccurdy/redis-py\n\nInstallation\n------------\n\n.. code-block:: bash\n\n $ pip install rejson\n\nUsage example\n-------------\n\n.. code-block:: python\n\n from rejson import Client, Path\n\n rj = Client(host='localhost', port=6379, decode_responses=True)\n\n # Set the key `obj` to some object\n obj = {\n 'answer': 42,\n 'arr': [None, True, 3.14],\n 'truth': {\n 'coord': 'out there'\n }\n }\n rj.jsonset('obj', Path.rootPath(), obj)\n\n # Get something\n print 'Is there anybody... {}?'.format(\n rj.jsonget('obj', Path('.truth.coord'))\n )\n\n # Delete something (or perhaps nothing), append something and pop it\n rj.jsondel('obj', Path('.arr[0]'))\n rj.jsonarrappend('obj', Path('.arr'), 'something')\n print '{} popped!'.format(rj.jsonarrpop('obj', Path('.arr')))\n\n # Update something else\n rj.jsonset('obj', Path('.answer'), 2.17)\n\n # And use just like the regular redis-py client\n jp = rj.pipeline()\n jp.set('foo', 'bar')\n jp.jsonset('baz', Path.rootPath(), 'qaz')\n jp.execute()\n\n\nEncoding/Decoding\n-----------------\n\nrejson-py uses Python's json_.\nThe client can be set to use custom encoders/decoders at creation, or by calling\nexplicitly the setEncoder_ () and\nsetDecoder_ () methods, respectively.\n\n.. _json: https://docs.python.org/2/library/json.html\n.. _setDecoder: ./API.md#setdecoder\n.. _setEncoder: ./API.md#setencoder\n\nThe following shows how to use this for a custom class that's stored as\na JSON string for example:\n\n.. code-block:: python\n\n from json import JSONEncoder, JSONDecoder\n from rejson import Client\n\n class CustomClass(object):\n \"Some non-JSON-serializable\"\n def __init__(self, s=None):\n if s is not None:\n # deserialize the instance from the serialization\n if s.startswith('CustomClass:'):\n ...\n else:\n raise Exception('unknown format')\n else:\n # initialize the instance\n ...\n\n def __str__(self):\n _str = 'CustomClass:'\n # append the instance's state to the serialization\n ...\n return _str\n\n ...\n\n class CustomEncoder(JSONEncoder):\n \"A custom encoder for the custom class\"\n def default(self, obj):\n if isinstance(obj, CustomClass):\n return str(obj)\n return json.JSONEncoder.encode(self, obj)\n\n class TestDecoder(JSONDecoder):\n \"A custom decoder for the custom class\"\n def decode(self, obj):\n d = json.JSONDecoder.decode(self, obj)\n if isinstance(d, basestring) and d.startswith('CustomClass:'):\n return CustomClass(d)\n return d\n\n # Create a new instance of CustomClass\n obj = CustomClass()\n\n # Create a new client with the custom encoder and decoder\n rj = Client(encoder=CustomEncoder(), decoder=CustomDecoder())\n\n # Store the object\n rj.jsonset('custom', Path.rootPath(), obj))\n\n # Retrieve it\n obj = rj.jsonget('custom', Path.rootPath())\n\n\nAPI\n---\n\nAs rejson-py exposes the same methods as redis-py, it can be used as a drop-in\nreplacement. On top of Redis' core commands, the client also adds ReJSON's\nvocabulary and a couple of helper methods. These are documented in the\n[API.md](API.md) file, which can be generated by running:\n\n.. code-block:: bash\n\n $ python gendoc rejson > API.md\n\n\nFor complete documentation about ReJSON's commands, refer to `ReJSON's website`_.\n\n.. _`ReJSON's website`: http://rejson.io\n\nLicense\n-------\n\n`BSD 2-Clause`_\n\n.. _`BSD 2-Clause`: https://github.com/RedisLabs/rejson-py/blob/master/LICENSE", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/RedisLabs/rejson-py", "keywords": "Redis JSON Extension", "license": "", "maintainer": "", "maintainer_email": "", "name": "rejson", "package_url": "https://pypi.org/project/rejson/", "platform": "", "project_url": "https://pypi.org/project/rejson/", "project_urls": { "Homepage": "http://github.com/RedisLabs/rejson-py" }, "release_url": "https://pypi.org/project/rejson/0.5.0/", "requires_dist": null, "requires_python": "", "summary": "ReJSON Python Client", "version": "0.5.0" }, "last_serial": 5767346, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f3a619da207c2850d72da1c9a4137a34", "sha256": "859cea11803aa6afba8b4a0f0daa657f85fffaad5e7c0bd87923b436da4fa005" }, "downloads": -1, "filename": "rejson-0.1.tar.gz", "has_sig": false, "md5_digest": "f3a619da207c2850d72da1c9a4137a34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5192, "upload_time": "2017-05-11T19:26:27", "url": "https://files.pythonhosted.org/packages/51/72/f1160821a18c5d282f32c7c835077b15113936badc73053e5e23a309ed20/rejson-0.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "9e580e2af5557c699f3c8f14ef2d2e8c", "sha256": "d34830edd8add521c9b537ad76fdb84ed07540f53f8835dda1bbe903893c3e66" }, "downloads": -1, "filename": "rejson-0.2.0.tar.gz", "has_sig": false, "md5_digest": "9e580e2af5557c699f3c8f14ef2d2e8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6560, "upload_time": "2017-06-05T16:12:06", "url": "https://files.pythonhosted.org/packages/de/25/545270325e24d2b5c1aee52f97b6ef76334ad08ae4c0d3a73cfc026846ae/rejson-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "1057e0aa5f1b47670cef048a0947635f", "sha256": "41afbf26eb8a788aa6377a3463e57d61e55f167cc2bd1dbfd0e96c8d54519efa" }, "downloads": -1, "filename": "rejson-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1057e0aa5f1b47670cef048a0947635f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7468, "upload_time": "2017-06-05T16:58:16", "url": "https://files.pythonhosted.org/packages/77/a4/bbb898ca52d2f535f4d346f20f48e989be72910982910f557b5ace6fcb9e/rejson-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "64b847b7269d211661529a4055fcf208", "sha256": "9cae89c81d90574d153676b69c2b7d456234ebeb7a90cfbbb58be71c72fd2af3" }, "downloads": -1, "filename": "rejson-0.3.0.tar.gz", "has_sig": false, "md5_digest": "64b847b7269d211661529a4055fcf208", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7493, "upload_time": "2019-01-07T13:57:39", "url": "https://files.pythonhosted.org/packages/0c/97/0b76541a753838083ba2bdf6501dd5278394d997993bdcd1afa5457e3a9a/rejson-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "961166f55cc671a50a10e18e38f18d84", "sha256": "381a920c6f79d6710c493a6da4abbd5511f27b6db1f3fc2bd6038e16c46be245" }, "downloads": -1, "filename": "rejson-0.4.0.tar.gz", "has_sig": false, "md5_digest": "961166f55cc671a50a10e18e38f18d84", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7648, "upload_time": "2019-03-08T06:22:19", "url": "https://files.pythonhosted.org/packages/69/b9/204574bc41d29c9727249a117ac7969879ddccdd133a661db9e702ed58a9/rejson-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "049805037aa6a0d6a50bd0cc7e81161d", "sha256": "7f2db37e8f4f0a05e7e210dbd1d9a583ce2b8a3fdfa3a6e9b47498b1536559df" }, "downloads": -1, "filename": "rejson-0.5.0.tar.gz", "has_sig": false, "md5_digest": "049805037aa6a0d6a50bd0cc7e81161d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8474, "upload_time": "2019-09-01T15:46:35", "url": "https://files.pythonhosted.org/packages/33/31/d85098ce0718e86b147296b296fd66b5f82f3d638d60a8798e6824b71a7a/rejson-0.5.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "049805037aa6a0d6a50bd0cc7e81161d", "sha256": "7f2db37e8f4f0a05e7e210dbd1d9a583ce2b8a3fdfa3a6e9b47498b1536559df" }, "downloads": -1, "filename": "rejson-0.5.0.tar.gz", "has_sig": false, "md5_digest": "049805037aa6a0d6a50bd0cc7e81161d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8474, "upload_time": "2019-09-01T15:46:35", "url": "https://files.pythonhosted.org/packages/33/31/d85098ce0718e86b147296b296fd66b5f82f3d638d60a8798e6824b71a7a/rejson-0.5.0.tar.gz" } ] }