{ "info": { "author": "Giorgio Salluzzo", "author_email": "giorgio.salluzzo@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application" ], "description": "Reding\n======\n\n[![Build Status](https://secure.travis-ci.org/BuongiornoMIP/Reding.png?branch=master)](https://travis-ci.org/BuongiornoMIP/Reding)\n[![Coverage Status](https://coveralls.io/repos/BuongiornoMIP/Reding/badge.png?branch=master)](https://coveralls.io/r/BuongiornoMIP/Reding)\n[![PyPi version](https://pypip.in/v/Reding/badge.png)](https://crate.io/packages/Reding/)\n[![PyPi downloads](https://pypip.in/d/Reding/badge.png)](https://crate.io/packages/Reding/)\n\nRating on Redis - REST API on Flask\n-----------------------------------\nReding is a *WSGI* Python app made using the amazing Flask web framework, and one of its extension, Flask-RESTful.\n\nOn Redis side, it uses the powerful sorted set data type to provide all the functionalities.\n\n\nInstallation:\n-------------\n```\npip install Reding\n```\n\n\nSome examples:\n--------------\nLet's start, my Reding is empty, no book has been voted:\n```\n$ curl -i http://localhost:5000/objects/\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 2\nDate: Fri, 01 Feb 2013 16:50:47 GMT\nServer: mindflayer\n```\n```json\n[]\n```\n\nI wanna give a '10' to the amazing 'Core Python Applications Programming' book (ISBN-13: 978-0132678209):\n```\n$ curl -i -XPUT http://localhost:5000/objects/978-0132678209/users/gsalluzzo/ -d \"vote=10\"\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 110\nDate: Fri, 01 Feb 2013 16:57:44 GMT\nServer: mindflayer\n```\n```json\n{\n \"vote\": 10,\n \"when\": \"Fri, 01 Feb 2013 17:57:44 -0000\",\n \"user_id\": \"gsalluzzo\",\n \"object_id\": \"978-0132678209\",\n \"review\": null\n}\n```\nEhy hackers, I've just used a PUT call, but yes, I know, it's the first vote, I should use a POST one. Reding maps POST method on the PUT one, so the client does not need to know if it's the first time I'm voting this object.\n\nOK, '10' is too much indeed, let's change it to '9', or the author will get crazy about that:\n```\n$ curl -i -XPUT http://localhost:5000/objects/978-0132678209/users/gsalluzzo/ -d \"vote=9\"\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 109\nDate: Fri, 01 Feb 2013 17:03:16 GMT\nServer: mindflayer\n```\n```json\n{\n \"vote\": 9,\n \"when\": \"Fri, 01 Feb 2013 18:03:16 -0000\",\n \"user_id\": \"gsalluzzo\",\n \"object_id\": \"978-0132678209\",\n \"review\": null\n}\n```\n\nLet's see if somebody voted something (my memory is like the gold fish one):\n```\n$ curl -i http://localhost:5000/objects/\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 79\nDate: Fri, 01 Feb 2013 17:05:46 GMT\nServer: mindflayer\n```\n```json\n[{\n \"amount\": 9,\n \"average\": \"9.0\",\n \"object_id\": \"978-0132678209\",\n \"votes_no\": 1\n}]\n```\n\nNot expected... ;) Let's enter another vote:\n```\n$ curl -i -XPUT http://localhost:5000/objects/978-0132678209/users/wchun/ -d \"vote=10\"\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 106\nDate: Fri, 01 Feb 2013 17:08:03 GMT\nServer: mindflayer\n```\n```json\n{\n \"vote\": 10,\n \"when\": \"Fri, 01 Feb 2013 18:08:03 -0000\",\n \"user_id\": \"wchun\",\n \"object_id\": \"978-0132678209\",\n \"review\": null\n}\n```\nThe author said '10'! What a surprise! :D\n\nLet's get the voted books again:\n```\n$ curl -i http://localhost:5000/objects/\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 80\nDate: Fri, 01 Feb 2013 17:09:42 GMT\nServer: mindflayer\n```\n```json\n[{\n \"amount\": 19,\n \"average\": \"9.5\",\n \"object_id\": \"978-0132678209\",\n \"votes_no\": 2\n}]\n```\n\nThere's only a book, what if I only get that one??\n```\n$ curl -i http://localhost:5000/objects/978-0132678209/\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 78\nDate: Fri, 01 Feb 2013 17:11:13 GMT\nServer: mindflayer\n```\n```json\n{\n \"amount\": 19,\n \"average\": \"9.5\",\n \"object_id\": \"978-0132678209\",\n \"votes_no\": 2\n}\n```\n\nOr what if I only get my single vote?\n```\n$ curl -i http://localhost:5000/objects/978-0132678209/users/gsalluzzo/\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 109\nDate: Fri, 01 Feb 2013 17:12:00 GMT\nServer: mindflayer\n```\n```json\n{\n \"vote\": 9,\n \"when\": \"Fri, 01 Feb 2013 18:03:16 -0000\",\n \"user_id\": \"gsalluzzo\",\n \"object_id\": \"978-0132678209\",\n \"review\": null\n}\n```\n\nLet's remove the author's one, he cheated:\n```\n$ curl -i -XDELETE http://localhost:5000/objects/978-0132678209/users/wchun/\nHTTP/1.1 204 NO CONTENT\nContent-Type: application/json\nContent-Length: 0\nDate: Fri, 01 Feb 2013 17:13:45 GMT\nServer: mindflayer\n```\n\nLet's enter my mom's vote, she does not like Python, she even doesn't know what it is...\n```\n$ curl -i -XPUT http://localhost:5000/objects/978-0132678209/users/mymom/ -d \"vote=3\"\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 105\nDate: Fri, 01 Feb 2013 17:15:38 GMT\nServer: mindflayer\n```\n```json\n{\n \"vote\": 3,\n \"when\": \"Fri, 01 Feb 2013 18:15:38 -0000\",\n \"user_id\": \"mymom\",\n \"object_id\": \"978-0132678209\",\n \"review\": null\n}\n```\n\nLet's see the average, it must be decreased:\n```\n$ curl -i http://localhost:5000/objects/978-0132678209/\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 78\nDate: Fri, 01 Feb 2013 17:17:09 GMT\nServer: mindflayer\n```\n```json\n{\n \"amount\": 12,\n \"average\": \"6.0\",\n \"object_id\": \"978-0132678209\",\n \"votes_no\": 2\n}\n```\n\nWell, stop programming books...I'm gonna give a '10' to the amazing 'The Lord of the Rings Sketchbook',\nbut this time let me add a review:\n```\n$ curl -i -XPUT http://localhost:5000/objects/978-0618640140/users/gsalluzzo/ -d \"vote=10&review=the \u2603 loves lotr\"\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 110\nDate: Fri, 01 Feb 2013 17:21:56 GMT\nServer: mindflayer\n```\n```json\n{\n \"vote\": 10,\n \"when\": \"Fri, 01 Feb 2013 18:21:56 -0000\",\n \"user_id\": \"gsalluzzo\",\n \"object_id\": \"978-0618640140\",\n \"review\": \"the \u2603 loves lotr\"\n}\n}\n```\n\nLet's see the books I voted and what I wrote about them:\n```\n$ curl -i http://localhost:5000/users/gsalluzzo/\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 223\nDate: Fri, 01 Feb 2013 17:22:55 GMT\nServer: mindflayer\n```\n```json\n[{\n \"vote\": 9,\n \"when\": \"Fri, 01 Feb 2013 18:03:16 -0000\",\n \"user_id\": \"gsalluzzo\",\n \"object_id\": \"978-0132678209\",\n \"review\": null\n}, {\n \"vote\": 10,\n \"when\": \"Fri, 01 Feb 2013 18:21:56 -0000\",\n \"user_id\": \"gsalluzzo\",\n \"object_id\": \"978-0618640140\",\n \"review\": \"the \u2603 loves lotr\"\n}]\n```\n\n...and again all books voted:\n```\n$ curl -i http://localhost:5000/objects/\nHTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 161\nDate: Fri, 01 Feb 2013 17:23:51 GMT\nServer: mindflayer\n```\n```json\n[{\n \"amount\": 10,\n \"average\": \"10.0\",\n \"object_id\": \"978-0618640140\",\n \"votes_no\": 1\n}, {\n \"amount\": 12,\n \"average\": \"6.0\",\n \"object_id\": \"978-0132678209\",\n \"votes_no\": 2\n}]\n```\n\n\nFilters (on GET's views):\n--------\n* *vote=* available on \"/objects/<>/\" and \"/objects/<>/users/\" interfaces.\n\n\nWhat's missing:\n----------------\n* List pagination; DONE!\n* List sorting; DONE!\n* Any suggestion?\n\n\nThanks to:\n----------\n* **Redis** project at http://redis.io/;\n* **Flask** project at http://flask.pocoo.org/;\n* **Flask-RESTful** project at https://github.com/twilio/flask-restful/;\n* **CherryPy** project at http://cherrypy.org/ - if you wanna try it right now!;\n* **Buongiorno S.p.A.** -my company-, letting me open sources to the world.\n\n\nLICENSE\n-------\nThe MIT License (MIT)\n\nCopyright (c) 2013 Buongiorno S.p.A.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "description_content_type": null, "docs_url": "https://pythonhosted.org/Reding/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://buongiornomip.github.com/Reding/", "keywords": "Rating REST Redis Flask", "license": "The MIT License (MIT)", "maintainer": null, "maintainer_email": null, "name": "Reding", "package_url": "https://pypi.org/project/Reding/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Reding/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://buongiornomip.github.com/Reding/" }, "release_url": "https://pypi.org/project/Reding/1.99.1/", "requires_dist": null, "requires_python": null, "summary": "[![PyPi downloads](https://pypip.in/d/Reding/badge.png)](https://crate.io/packages/Reding/)", "version": "1.99.1" }, "last_serial": 872885, "releases": { "1.2.5": [ { "comment_text": "", "digests": { "md5": "9963cc187c1ef25e88ee3565e820c148", "sha256": "585d8fe9c7ad2ad486c37c777d1371419e636ddd044fad65ed1b67440309dea5" }, "downloads": -1, "filename": "Reding-1.2.5.tar.gz", "has_sig": false, "md5_digest": "9963cc187c1ef25e88ee3565e820c148", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9496, "upload_time": "2013-06-27T19:49:42", "url": "https://files.pythonhosted.org/packages/e7/ed/51b46ce6da9f4274e04cee9dcd0eb6ff2100737f2a6c1b71c7f3d5119404/Reding-1.2.5.tar.gz" } ], "1.99.1": [ { "comment_text": "", "digests": { "md5": "7fc9a91deefa85918b808a8565f373eb", "sha256": "0695339dcf80e5a36c49841aaf1b56d702d10122b92e41154d2d0a1a3b5bda84" }, "downloads": -1, "filename": "Reding-1.99.1.tar.gz", "has_sig": false, "md5_digest": "7fc9a91deefa85918b808a8565f373eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9959, "upload_time": "2013-09-14T10:32:44", "url": "https://files.pythonhosted.org/packages/7e/40/c37cc7d89b4e9edbfe8b943b1db62658407d88323326059a07d16084d470/Reding-1.99.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7fc9a91deefa85918b808a8565f373eb", "sha256": "0695339dcf80e5a36c49841aaf1b56d702d10122b92e41154d2d0a1a3b5bda84" }, "downloads": -1, "filename": "Reding-1.99.1.tar.gz", "has_sig": false, "md5_digest": "7fc9a91deefa85918b808a8565f373eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9959, "upload_time": "2013-09-14T10:32:44", "url": "https://files.pythonhosted.org/packages/7e/40/c37cc7d89b4e9edbfe8b943b1db62658407d88323326059a07d16084d470/Reding-1.99.1.tar.gz" } ] }