{ "info": { "author": "K.Danilov aka koder", "author_email": "koder.mail@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "prest documentation\n===================\n\nWriting a Python API for a REST service is quite a boring task.\nprest is intended to do all of the monkey work for you. Take\na look at an example: ::\n\n\tfrom prest import EasyRestBase, GET, POST, DELETE\n\n\n\tclass MyRestfullAPI(EasyRestBase):\n\t list_objs = GET('objects')\n\t get_obj = GET('objects/{id}')\n\t del_obj = DELETE('objects/{id}')\n\t create_obj = POST('objects')\n\t select_objs = GET('objects/filter')\n\t objs_by_type = GET('objects/{type}')\n\n\n\tconn = MyRestfullAPI(\"http://some.api.com/my_api/v2.0\")\n\n\tprint conn.list_objs()\n\n\tobj_id = conn.create_obj()['id']\n\tconn.select_objs(color='read')\n\tconn.del_obj(id=obj_id)\n\tconn.objs_by_type(type='red')\n\n\nThere are 6 basic functions for HTTP methods:\n\n- GET\n- POST\n- PUT\n- PATCH\n- DELETE\n- HEAD\n\nEach of them\nrequires a relative path and returns a function. This \nfunction, in turn, gets a connection and a set of \nparameters, inserts some of them in the url (if there are placeholders), \nattaches all the rest as GET/POST parameters, and makes \nan HTTP request. The function receives the result, unpacks it and returns the result to the caller.\n\nSo you need only one line to make an API func for \neach REST call.\n\t\nIn case if result of GET/... calls is assigned to\nclass method of class inherited from PRestBase\nthen call gets connection from self. \n\nMeanwhile you can use it separately::\n\n\tfrom prest import GET, Urllib2HTTP_JSON\n\n\tget_cluster_data = GET('data/{cluster_id}')\n\tconn = Urllib2HTTP_JSON(\"http://my_api.org\")\n\tprint get_cluster_data(conn, cluster_id=11)\n\n\nBoth Urllib2HTTP_JSON and PRestBase\naccepts dictionary of additional headers end echo\nparameters. Urllib2HTTP_JSON uses json.dumps and \njson.loads to serialize and deserialize data accordingly.\n\nParameter dispatching rules::\n\n\tfunc = GET('a/b/{c}/{d}?m={m}')\n\tfunc(positional_param, **names_params)\n\n* All named parameters, which match placeholders in url\n would be formatted into url.\n\n* From named parameters, which doesn't match placeholders,\n would be created dictionary, which would be passed as request\n body.\n\n* If not all url placeholder values are provided as named\n parameters all the rest values would be taken from self,\n if api function is inside class.\n\n* If some placeholder cannot be found neither in parameters\n not in self (or no self is provided - in case of standalone\n function). ValueError would be raised.\n\n* At most one positional parameter is allowed. If positional \n parameter is provided it would be used as entire request body.\n All named parameters in this case should be formatted into url.\n In case if extra named parameters provided - ValueError\n would be raised.\n\nThere also an object-oriented API - please take\na look on test_orm.py. I wrote no documentation \nfor it, as it currently breaks 17th rule of python Zen.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/koder-ua/prest", "keywords": null, "license": "LGPL", "maintainer": null, "maintainer_email": null, "name": "prest", "package_url": "https://pypi.org/project/prest/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/prest/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/koder-ua/prest" }, "release_url": "https://pypi.org/project/prest/0.3/", "requires_dist": null, "requires_python": null, "summary": "This module makes writing client API for REST services as easy as GET('my_api/{some_param}')", "version": "0.3" }, "last_serial": 1433323, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "268038564ce6e78efe8bc13bf3f7178b", "sha256": "10b52b5f8f5bacd7f4526827c5c9d69592cd84842d32aa08ea0a68c2bdd1fad3" }, "downloads": -1, "filename": "prest-0.1.tar.gz", "has_sig": false, "md5_digest": "268038564ce6e78efe8bc13bf3f7178b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6654, "upload_time": "2015-02-19T05:29:01", "url": "https://files.pythonhosted.org/packages/20/a8/ac46f559a0abe3a6eaf858f57adeef22f470bcb22d2007b233eb5659c79d/prest-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "13193d7065d74b00ff405e7d79f69680", "sha256": "3e5d86c1f14b820f896cd0984eae407bfc5664870067697203544ed68f9898da" }, "downloads": -1, "filename": "prest-0.2.tar.gz", "has_sig": false, "md5_digest": "13193d7065d74b00ff405e7d79f69680", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6760, "upload_time": "2015-02-20T23:04:57", "url": "https://files.pythonhosted.org/packages/db/71/1b5e21864025b82472c47b2a65db4c6102d440e1d6570706c055535cfd85/prest-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "e94fafa1cf879bbbe5b6baf0dd0603a5", "sha256": "d50d51da501be72709dfda108d197f30eadfec7e5ec21a6a3c30517fb728dd4b" }, "downloads": -1, "filename": "prest-0.2.1.tar.gz", "has_sig": false, "md5_digest": "e94fafa1cf879bbbe5b6baf0dd0603a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7159, "upload_time": "2015-02-20T23:09:19", "url": "https://files.pythonhosted.org/packages/25/e8/62d23a4c2824231ee5e69ba211630f22a8b6dbfaeadef7ca177ccbec5dbd/prest-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "61a77aaa0a6910804f3feeff1c352f22", "sha256": "823716f464b88b8f40688739c758dd122b8ad5005ca0b7035c95264a8b79c49f" }, "downloads": -1, "filename": "prest-0.2.2.tar.gz", "has_sig": false, "md5_digest": "61a77aaa0a6910804f3feeff1c352f22", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7161, "upload_time": "2015-02-20T23:14:45", "url": "https://files.pythonhosted.org/packages/84/f8/0279e34bc4df30361ef675428d71cd3f5fc55a4f91bff54e8f9a4afe2b16/prest-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "5e8577b8a24eb4b70f2ce84d21c158e5", "sha256": "bf32310efd3d5e96b286dcadfc0613dd534eadecfbc93dbe4cd5673ed5dacab9" }, "downloads": -1, "filename": "prest-0.2.3.tar.gz", "has_sig": false, "md5_digest": "5e8577b8a24eb4b70f2ce84d21c158e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7185, "upload_time": "2015-02-21T01:34:25", "url": "https://files.pythonhosted.org/packages/24/9a/c613a43f30b4305fc67e899d6d3ba059542269f0a3ae13ec16efbb7706a5/prest-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "722e7e835c19d4eca5a109e91961d568", "sha256": "62e8513e5615645e5f346a105853fb4d557734ebc9e123aecd3d697f20c9adee" }, "downloads": -1, "filename": "prest-0.2.4.tar.gz", "has_sig": false, "md5_digest": "722e7e835c19d4eca5a109e91961d568", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7188, "upload_time": "2015-02-21T01:37:10", "url": "https://files.pythonhosted.org/packages/75/e8/0ff62d80d5388f6eb002693a91620fe4d739a0da63c8362f587416761f98/prest-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "7f4ce1bb258896d5366677d0420555ee", "sha256": "d72eb753aa4ee93d6df6b2370ef46aef6d041e327f458b82943333e2347653e8" }, "downloads": -1, "filename": "prest-0.2.5.tar.gz", "has_sig": false, "md5_digest": "7f4ce1bb258896d5366677d0420555ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7205, "upload_time": "2015-02-21T01:38:39", "url": "https://files.pythonhosted.org/packages/a8/bc/11b4e8cb5d40cd5a5fbb798405eb53c25e737b3aba529566b17db359f566/prest-0.2.5.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "de0bbf6e92462ab31155e97c492ea7f6", "sha256": "8253027bb70a7de7e10e3a95f1ad289c9cb0af6e1362ee073d6e47663854aa01" }, "downloads": -1, "filename": "prest-0.2.6.tar.gz", "has_sig": false, "md5_digest": "de0bbf6e92462ab31155e97c492ea7f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7280, "upload_time": "2015-02-21T06:43:29", "url": "https://files.pythonhosted.org/packages/fd/77/ab7bff16b2a3bc6ca764477257ddec7cc4fd7c4827db4a7fafa81a9765ba/prest-0.2.6.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "269263ed00a60b11a8c7f9d3eab3fe78", "sha256": "34c0cab8ad355fd7a9bb963a9c0ea64f716c3ae49aff424d8df577e88e42f409" }, "downloads": -1, "filename": "prest-0.3.tar.gz", "has_sig": false, "md5_digest": "269263ed00a60b11a8c7f9d3eab3fe78", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8451, "upload_time": "2015-02-22T17:17:44", "url": "https://files.pythonhosted.org/packages/ce/46/1eaeee04ec9033a07a4a297c7623b3c5b36f763fe6cee4dad2ca8600cf96/prest-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "269263ed00a60b11a8c7f9d3eab3fe78", "sha256": "34c0cab8ad355fd7a9bb963a9c0ea64f716c3ae49aff424d8df577e88e42f409" }, "downloads": -1, "filename": "prest-0.3.tar.gz", "has_sig": false, "md5_digest": "269263ed00a60b11a8c7f9d3eab3fe78", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8451, "upload_time": "2015-02-22T17:17:44", "url": "https://files.pythonhosted.org/packages/ce/46/1eaeee04ec9033a07a4a297c7623b3c5b36f763fe6cee4dad2ca8600cf96/prest-0.3.tar.gz" } ] }