{ "info": { "author": "Christopher Arndt", "author_email": "chris@chrisarndt.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Other Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: MicroPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Database", "Topic :: Home Automation", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Networking" ], "description": "PicoRedis\n=========\n\nOverview\n--------\n\n**PicoRedis** is a very minimal Redis client (not only) for MicroPython.\n\nWhat is does\n~~~~~~~~~~~~\n\n- Support the **RE**\\ dis **S**\\ erialization **P**\\ rotocol\n (`RESP `__).\n- Connect to a Redis server via TCP.\n- Send `Redis commands `__ and receive and\n parse the response in a simple, blocking fashion.\n- Support MicroPython (unix and bare-metal ports with ``usocket`` and\n ``uselect`` module), CPython and PyPy (3.4+, 2.7+ untested).\n\nWhat it does not\n~~~~~~~~~~~~~~~~\n\n- Parse the response beyond de-serialization of the basic RESP types\n (``simple string``, ``error``, ``bulk string``, ``integer`` and\n ``array``).\n- Decode response byte strings, except error messages.\n- Support the subscribe / publish protocol.\n- Support SSL / TLS (yet).\n- Async I/O.\n\nUsage\n-----\n\n.. code:: python\n\n >>> from picoredis import Redis\n >>> redis = Redis() # server defaults to 127.0.0.1 port 6379\n >>> redis.do_cmd('PING', 'Hello World!')\n b'Hello World!'\n\nInstead of using the ``do_cmd`` method, ``Redis`` instances can be\ncalled directly:\n\n.. code:: python\n\n >>> redis('SET', 'foo', 'bar')\n b'OK'\n >>> redis('GET', 'foo')\n b'bar' # string responses are always byte strings\n\nOr you can call arbitrary methods on the ``Redis`` instance, and the\nmethod name will be used as the Redis command:\n\n.. code:: python\n\n >>> redis.hset('myhash', 'key1', 42)\n 1\n >>> redis.hkeys('myhash')\n [b'key1']\n\nYou can use any method name consisting of *only* letters, except\n``connect``, ``close``, ``debug`` (and ``do_cmd``), which are already\nused as instance attribute or method names. If the name does not\ncorrespond to a valid Redis command, the server will return an error and\na ``RedisError`` exception will be raised:\n\n.. code:: python\n\n >>> redis.bogus('spam!')\n Traceback (most recent call last):\n File \"\", line 1, in \n File \"picoredis.py\", line 72, in \n File \"picoredis.py\", line 66, in do_cmd\n File \"picoredis.py\", line 82, in _read_response\n RedisError: ('ERR', \"unknown command 'bogus'\")\n\nConnection\n~~~~~~~~~~\n\nWhen you create a ``Redis`` instance, it immediatly tries to open a\nconnecting to the Redis server. The default host and port are\n``127.0.0.1`` and ``6379`` respectively.\n\nYou can set the host name or IP address and port number of the Redis\nserver to connect with the ``host`` and ``port`` keyword arguments:\n\n.. code:: python\n\n >>> redis = Redis('192.168.1.100')\n >>> redis = Redis(port=6380)\n >>> redis = Redis('192.168.1.100', 6380)\n >>> redis = Redis(host='192.168.1.100')\n >>> redis = Redis(host='192.168.1.100', port=6380)\n\nYou can set the TCP socket timeout with the ``timeout`` keyword argument\nin milliseconds (default 3000):\n\n.. code:: python\n\n >>> redis = Redis(timeout=10000)\n\nIf a response is read from the server and the server doesn\u2019t return any\ndata within the timeout, a ``RedisTimeout`` exception is raised.\n\nTo close the connection to the server, use the ``close()`` method:\n\n.. code:: python\n\n >>> redis.close()\n >>> redis.ping()\n Traceback (most recent call last):\n File \"\", line 1, in \n File \"picoredis.py\", line 89, in \n File \"picoredis.py\", line 75, in do_cmd\n RedisError: Not connected: use 'connect()' to connect to Redis server.\n\nTo open a new connection again, use the ``connect`` method. You can pass\na different host name and / or port number and they will overwrite the\nones given when the instance was created:\n\n.. code:: python\n\n >>> redis.connect('redis.myserver.com')\n >>> redis._host\n 'redis.myserver.com'\n\nDebug Output\n~~~~~~~~~~~~\n\nTo turn on printing of raw messages sent to and received from the Redis\nserver pass ``debug=True`` when creating the instance or set its\n``debug`` attribute to ``True``:\n\n.. code:: python\n\n >>> redis = Redis(debug=True)\n >>> redis.hkeys('myhash')\n SEND: '*2\\r\\n$5\\r\\nhkeys\\r\\n$6\\r\\nmyhash\\r\\n'\n RECV: b'*1\\r\\n'\n RECV: b'$4\\r\\n'\n RECV: b'key1\\r\\n'\n [b'key1']\n\nTips\n~~~~\n\nIf you need to further parse the response to a Redis command regularly,\njust add a wrapper method in a sub-class. For example, here is how to\nget the list of commands supported by the Redis server as a list of\nstrings:\n\n.. code:: python\n\n >>> class MyRedis(Redis):\n ... def command_list(self):\n ... return sorted([cmd[0].decode('utf-8')\n ... for cmd in self.do_cmd('command')])\n >>> redis = MyRedis()\n >>> redis.command_list()\n ['append', 'asking', 'auth', 'bgrewriteaof', 'bgsave', 'bitcount', 'bitfield',\n ..., 'zunionstore']\n\n**Warning:** The response to this command sent be the Redis server will\nbe fairly big and probably cause a ``MemoryError``, when you run it on a\nmemory-constrained device like an ESP8266-based board.\n\nInstallation\n------------\n\nOn CPython and PyPy use ``pip`` to install as usual:\n\n::\n\n $ pip install picoredis\n\nOn MicroPython, just download the\n`picoredis.py `__\nfile from the repository and, for the unix port, put it into your\nMICROPYPATH directory (normally ``~/.micropython/lib``), or for\nbase-metal ports (*esp8266*, *stm32*, *wipy*, etc.) upload it to the\nflash storage of your MicroPython board, for example using\n`ampy `__:\n\n::\n\n $ curl -O https://raw.githubusercontent.com/SpotlightKid/picoredis/master/picoredis/picoredis.py\n $ ampy -p /dev/ttyUSB0 put picoredis.py\n\nYou can also compile the ``picoredis.py`` module with\n`mpy-cross `__\nand use the resulting ``picoredis.mpy`` file as a drop-in replacement\nfor the pure Python version. This will save you a good bit of memory on\nyour MicroPython board, because the byte-code compilation step, that\nnormally happens when you import the module, can be skipped:\n\n::\n\n $ mpy-cross picoredis.py\n $ ampy -p /dev/ttyUSB0 put picoredis.mpy\n\nLicense\n-------\n\n**PicoRedis** was written and is copyrighted by Christopher Arndt, 2017.\n\nIt is distributed under the terms of the `MIT\nlicense `__, **PicoRedis** is free\nand open source software.\n\nAcknowledgements\n----------------\n\nSome inspiration and code ideas were taken from these projects:\n\n- `micropython-redis `__\n by Dwight Hubbard\n- `redis_protocol `__ by\n Young King\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SpotlightKid/picoredis", "keywords": "database,micropython,redis,network", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "picoredis", "package_url": "https://pypi.org/project/picoredis/", "platform": "", "project_url": "https://pypi.org/project/picoredis/", "project_urls": { "Homepage": "https://github.com/SpotlightKid/picoredis" }, "release_url": "https://pypi.org/project/picoredis/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "A very minimal Python Redis client library (not only) for MicroPython", "version": "0.1.1" }, "last_serial": 3413789, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1bca9352a060a22abf06ea1c1a52737a", "sha256": "876521fc7c58ef807cb7803eaeb09477c04e9cd917a2675f9c0c50e7bd790c58" }, "downloads": -1, "filename": "picoredis-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1bca9352a060a22abf06ea1c1a52737a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9357, "upload_time": "2017-11-28T20:01:56", "url": "https://files.pythonhosted.org/packages/ff/ed/6664b6052fb117adb8b7e4ea3201056bcf4b7b41dab4c421e211f52a2793/picoredis-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9e81728a89403a035ea9c9dfe0804cb7", "sha256": "4c5f908c5d304c051400c0c6c1a7cc2922b3005326e1ffaa0b6d29ba0495d240" }, "downloads": -1, "filename": "picoredis-0.1.0.tar.gz", "has_sig": false, "md5_digest": "9e81728a89403a035ea9c9dfe0804cb7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9548, "upload_time": "2017-11-28T20:01:59", "url": "https://files.pythonhosted.org/packages/69/23/4548bc790b2cfb005a75a084c92d9284deadbe85fc1f6398e251fac831e3/picoredis-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "54dd7133b9d63a843f6e0f29efa210c4", "sha256": "795a3738312276b8d2870600d3e443835ca6c6374d436e7d44d48c6426195bba" }, "downloads": -1, "filename": "picoredis-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "54dd7133b9d63a843f6e0f29efa210c4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9365, "upload_time": "2017-12-13T16:24:00", "url": "https://files.pythonhosted.org/packages/ad/e8/4bd4e30a2e2763b628518b5068acf98336c8d98d4cf10a2072b6c6525cdd/picoredis-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1a740bcd07747ccd13907027d5d1e721", "sha256": "a7e542ab07a2fd45594c27fcb9ae89df73a5dfa4d6261da3d9e3abda1f08613d" }, "downloads": -1, "filename": "picoredis-0.1.1.tar.gz", "has_sig": false, "md5_digest": "1a740bcd07747ccd13907027d5d1e721", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9466, "upload_time": "2017-12-13T16:24:03", "url": "https://files.pythonhosted.org/packages/89/a2/48db8eece2e89f829d3c9f8cb14f75830579fddc084933d35020d562f2b2/picoredis-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "54dd7133b9d63a843f6e0f29efa210c4", "sha256": "795a3738312276b8d2870600d3e443835ca6c6374d436e7d44d48c6426195bba" }, "downloads": -1, "filename": "picoredis-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "54dd7133b9d63a843f6e0f29efa210c4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9365, "upload_time": "2017-12-13T16:24:00", "url": "https://files.pythonhosted.org/packages/ad/e8/4bd4e30a2e2763b628518b5068acf98336c8d98d4cf10a2072b6c6525cdd/picoredis-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1a740bcd07747ccd13907027d5d1e721", "sha256": "a7e542ab07a2fd45594c27fcb9ae89df73a5dfa4d6261da3d9e3abda1f08613d" }, "downloads": -1, "filename": "picoredis-0.1.1.tar.gz", "has_sig": false, "md5_digest": "1a740bcd07747ccd13907027d5d1e721", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9466, "upload_time": "2017-12-13T16:24:03", "url": "https://files.pythonhosted.org/packages/89/a2/48db8eece2e89f829d3c9f8cb14f75830579fddc084933d35020d562f2b2/picoredis-0.1.1.tar.gz" } ] }