{ "info": { "author": "Jacob Sondergaard", "author_email": "jacob@nephics.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "Blocking and non-blocking (asynchronous) clients for CouchDB using Tornado's httpclient\n=======================================================================================\n\nThis Python module wraps the CouchDB HTTP REST API and defines a common\ninterface for making blocking and non-blocking operations on a CouchDB.\n\nInstall\n-------\n\nInstall using ``pip``:\n\n::\n\n pip install tornado-couchdb\n\nThe code has been tested with Python 3.3 and 2.7.\n\nBlockingCouch\n-------------\n\nThe BlockingCouch class is a basic wrapper for making blocking\noperations on a CouchDB. Using this class implies that the Tornado\neventloop is blocked on a database call, waiting for reply from the\ndatabase.\n\nUse this class when blocking the eventloop *is not* a problem, or when\nthere is a *low latency connection* to the database, and the operations\nare \"small\", i.e., only takes short time (in the range of tens of\nmiliseconds) to complete.\n\nExample usage:\n\n::\n\n import couch\n\n db = couch.BlockingCouch('mytestdb')\n db.create_db()\n r = db.save_doc({'msg': 'My first document'})\n doc = db.get_doc(r['id'])\n db.delete_doc(doc)\n\nFor any methods of this class: If an error is returned from the\ndatabase, an exception is raised using an appropriate sub-class of\nCouchException.\n\nExample error handling:\n\n::\n\n import couch\n\n db = couch.AsyncCouch('mytestdb')\n try:\n doc = db.get_doc('non-existing-id')\n except couch.NotFound:\n print('Document not found')\n\nAsyncCouch\n----------\n\nThe AsyncCouch class is a basic wrapper for making non-blocking\noperations on a CouchDB. Using this class implies that the Tornado\neventloop is *not* blocked on a database call, and reply from the\ndatabase is returned as a Future or delivered to a callback function.\n\nUse this class when blocking the eventloop *is* a problem, or when there\nis a *high latency connection* to the database, and the operations are\n\"large\", i.e., takes long time (in the range of seconds) to complete.\n\nExample usage with coroutine:\n\n::\n\n import couch\n from tornado import ioloop, gen\n\n @gen.coroutine\n def run_test():\n db = couch.AsyncCouch('mytestdb')\n yield db.create_db()\n r = yield db.save_doc({'msg': 'My first document'})\n doc = yield db.get_doc(r['id'])\n yield db.delete_doc(doc)\n yield db.delete_db()\n\n ioloop.IOLoop.run_sync(run_test)\n\nFor any methods of this class: If the database call results in an error,\nan exception is raised at the callpoint using an appropriate sub-class\nof CouchException. This applies *both* when calling with a callback\nfunction and when yielding to a Future (using gen.coroutine).\n\nExample error handling:\n\n::\n\n import couch\n from tornado import ioloop, gen\n \n @gen.coroutine\n def main():\n db = couch.AsyncCouch('mytestdb')\n try:\n doc = yield db.get_doc('non-existing-id')\n except couch.NotFound:\n print('Document not found')\n \n ioloop.IOLoop.run_sync(main)\n\nNote: In versions before 0.2.0, if error occured in the database call,\nAsyncCouch would pass the exception as a parameter to the callback\nfunction.\n\nBlockingCouch and AsyncCouch methods\n------------------------------------\n\nGeneral methods.\n\n::\n\n use(self, db_name='', couch_url='http://127.0.0.1:5984/'):\n Set database name `db_name` and `couch_url`.\n\n close(self):\n Closes the CouchDB client, freeing any resources used.\n\nDatabase related methods.\n\n::\n\n create_db(self, db_name=None):\n Creates a new database.\n\n delete_db(self, db_name=None):\n Deletes the database.\n\n list_dbs(self):\n List names of databases.\n\n info_db(self, db_name=None):\n Get info about the database.\n\n pull_db(self, source, db_name=None, create_target=False):\n Replicate changes from a source database to current (target)\n database.\n\n uuids(self, count=1):\n Get one or more uuids.\n\nDocument related methods.\n\n::\n\n get_doc(self, doc_id):\n Get document with the given `doc_id`.\n\n get_docs(self, doc_ids):\n Get multiple documents with the given list of `doc_ids`.\n \n Response is a list with the requested documents, in same order as the\n provided document id's.\n \n If one or more documents are not found in the database, a NotFound\n exception is raised.\n\n has_doc(self, doc_id):\n Check if document with the given `doc_id` exists.\n Returns True if document exists, returns False otherwise.\n\n save_doc(self, doc):\n Save/create a document to/in a given database. Response is a dict\n with id and rev of the saved doc.\n\n save_docs(self, docs, all_or_nothing=False):\n Save/create multiple documents.\n Response is a list of dicts with id and rev of the saved docs.\n\n delete_doc(self, doc):\n Delete a document\n The `doc` shall be a dict, at least having the keys `_id` and `_rev`.\n\n delete_docs(self, docs, all_or_nothing=False):\n Delete multiple documents\n The `docs` shall be an array of dicts, each at least having the keys\n `_id` and `_rev`.\n\n get_attachment(self, doc, attachment_name, mimetype=None):\n Get document attachment.\n The parameter `doc` should at least contain an `_id` key.\n If mimetype is not specified, `doc` shall contain an `_attachments`\n key with info about the named attachment.\n\n save_attachment(self, doc, attachment):\n Save an attachment to the specified doc.\n The attachment shall be a dict with keys: `mimetype`, `name`, `data`.\n The `doc` shall be a dict, at least having the key `_id`, and if doc is\n existing in the database, it shall also contain the key `_rev`\n\n delete_attachment(self, doc, attachment_name):\n Delete a named attachment to the specified doc.\n The doc shall be a dict, at least with the keys: _id and _rev\n\n view(self, design_doc_name, view_name, **kwargs):\n Query a pre-defined view in the specified design doc.\n The following query parameters can be specified as keyword arguments.\n \n Limit query results to those with the specified key or list of keys:\n key=\n keys=\n \n Limit query results to those following the specified startkey:\n startkey=\n \n First document id to include in the output:\n startkey_docid=\n \n Limit query results to those previous to the specified endkey:\n endkey=\n \n Last document id to include in the output:\n endkey_docid=\n \n Limit the number of documents in the output:\n limit=\n \n Prevent CouchDB from refreshing a stale view:\n stale=\"ok\"\n stale=\"update_after\"\n \n Reverse the output:\n descending=True\n descending=False (default value)\n \n Note that the descending option is applied before any key filtering, so\n you may need to swap the values of the startkey and endkey options to\n get the expected results.\n \n Skip the specified number of docs in the query results:\n skip= (default value is 0)\n \n The group option controls whether the reduce function reduces to a set\n of distinct keys or to a single result row:\n group=True\n group=False (default value)\n \n group_level=\n \n Use the reduce function of the view:\n reduce=True (default value)\n reduce=False\n \n Note that default value of reduce is True, only if a reduce function is\n defined for the view.\n \n Automatically fetch and include the document which emitted each view\n entry:\n include_docs=True\n include_docs=False (default value)\n \n Determine whether the endkey is included in the result:\n inclusive_end=True (default value)\n inclusive_end=False\n\n view_all_docs(self, **kwargs):\n Query the _all_docs view.\n Accepts the same keyword parameters as `view()`.\n\n temp_view(self, view_doc, **kwargs):\n Query a temporary view.\n The view_doc parameter is a dict with the view's map and reduce\n functions.\n\nExceptions on database call errors\n----------------------------------\n\nThe following exception classes are used for the various database call\nerrors:\n\n``CouchException``: Base class for CouchDB specific exceptions. It is a\nsub-class of ``tornado.httpclient.HTTPError``, and it therefore also\ncontains the HTTP error message, response and error code.\n\n``NotModified``: The document has not been modified since the last\nupdate.\n\n``BadRequest``: The syntax of the request was invalid or could not be\nprocessed.\n\n``NotFound``: The requested resource was not found.\n\n``MethodNotAllowed``: The request was made using an incorrect request\nmethod; for example, a GET was used where a POST was required.\n\n``Conflict``: The request failed because of a database conflict.\n\n``PreconditionFailed``: Could not create database - a database with that\nname already exists.\n\n``InternalServerError``: The request was invalid and failed, or an error\noccurred within the CouchDB server that prevented it from processing the\nrequest.\n\nLicense\n-------\n\n| Copyright (c) 2010-2015 Nephics AB\n| MIT License, see the LICENSE file.", "description_content_type": null, "docs_url": null, "download_url": "https://bitbucket.org/nephics/tornado-couchdb/get/v0.3.0.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/nephics/tornado-couchdb", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "tornado-couchdb", "package_url": "https://pypi.org/project/tornado-couchdb/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/tornado-couchdb/", "project_urls": { "Download": "https://bitbucket.org/nephics/tornado-couchdb/get/v0.3.0.tar.gz", "Homepage": "https://bitbucket.org/nephics/tornado-couchdb" }, "release_url": "https://pypi.org/project/tornado-couchdb/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "Blocking and non-blocking (asynchronous) clients for CouchDB using Tornado's httpclient", "version": "0.3.0" }, "last_serial": 1579650, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "b0a03373edb23298564c60fe8ca81941", "sha256": "1eadd6c5805f73da301558f27b33e118edd67074c1291f3f0cb20a2caa62e30b" }, "downloads": -1, "filename": "tornado-couchdb-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b0a03373edb23298564c60fe8ca81941", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8926, "upload_time": "2013-04-16T10:44:53", "url": "https://files.pythonhosted.org/packages/69/de/467276e3d567c2d7ebecc9d00dcb2a8570fe000bb910e4fc1584f0bb44bc/tornado-couchdb-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "69044b2e768310cca711da1d7f067485", "sha256": "bf38ba14f43bd0bb608e9165608b4a4977805519458e2fdcd98d987a0a8940db" }, "downloads": -1, "filename": "tornado-couchdb-0.1.2.tar.gz", "has_sig": false, "md5_digest": "69044b2e768310cca711da1d7f067485", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8907, "upload_time": "2013-04-17T09:56:21", "url": "https://files.pythonhosted.org/packages/df/0e/45fdbb4e8069bed9f5474c1818c0a17596b4b2bcd1f1e2f15383113d41e0/tornado-couchdb-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "af35868403f84ac9c836b8f260afb590", "sha256": "ff9be25272ab798d726519ee540550079558a3752cbd05e483a6c83828d08e6d" }, "downloads": -1, "filename": "tornado-couchdb-0.2.0.tar.gz", "has_sig": false, "md5_digest": "af35868403f84ac9c836b8f260afb590", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7969, "upload_time": "2013-09-27T11:14:39", "url": "https://files.pythonhosted.org/packages/74/5e/e1f4266795e327f4ecce9b68076f51c91f3764489f6777c50ad83fd6ad65/tornado-couchdb-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "500dbab31827f6d818d49a0ad9d03a3e", "sha256": "ff3178c8ab7b59b8fdfa0c1b649571abb95832d10ebd0abc9c9bb7d28f167e39" }, "downloads": -1, "filename": "tornado-couchdb-0.2.1.tar.gz", "has_sig": false, "md5_digest": "500dbab31827f6d818d49a0ad9d03a3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7964, "upload_time": "2013-12-16T10:56:16", "url": "https://files.pythonhosted.org/packages/de/64/98d3408617a6eaf42cfb488c41a33b94d85974e0973366440327f6a8a135/tornado-couchdb-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "9a1cf25b17443cb5b8a62fecf287db58", "sha256": "9c4d669faf4aa7c46ead29ec525cb3ca9535d8bcd3595490e4cfdb5ebd7ff289" }, "downloads": -1, "filename": "tornado-couchdb-0.2.2.tar.gz", "has_sig": false, "md5_digest": "9a1cf25b17443cb5b8a62fecf287db58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8170, "upload_time": "2014-01-22T15:00:20", "url": "https://files.pythonhosted.org/packages/28/da/4a8ed638f5d44bc52ba9853cecbfcc84791758065e63fc9d026468b59977/tornado-couchdb-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "0b950b85fc596ba7ebdd1bf3417764fd", "sha256": "89786736a7fedab1c8897c5cf8948b7300ad7b83db7d4162795c776589504435" }, "downloads": -1, "filename": "tornado-couchdb-0.2.3.tar.gz", "has_sig": false, "md5_digest": "0b950b85fc596ba7ebdd1bf3417764fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11168, "upload_time": "2014-04-25T14:31:44", "url": "https://files.pythonhosted.org/packages/3a/64/15ebe0af103f51475db2e4f82bb3674b6adecbf0a2e231963992432acdd4/tornado-couchdb-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "e79404ff089adbf367ffb8b0be597047", "sha256": "0826372840de7b890fc65a83abb29d6355c50a3953f5d9b8d35c618ff6c11394" }, "downloads": -1, "filename": "tornado-couchdb-0.2.4.tar.gz", "has_sig": false, "md5_digest": "e79404ff089adbf367ffb8b0be597047", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12209, "upload_time": "2015-03-02T14:28:01", "url": "https://files.pythonhosted.org/packages/2f/a5/d5ef0611389ada3f4a2ccf432a19d23cde361f498cb47cd925ed796ceed9/tornado-couchdb-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "22ac1436580d867c487f917914dc98ae", "sha256": "c9ea219ee711ad9d7423ba224db02891aa61d970121b020e33d3d5fcd0ba173b" }, "downloads": -1, "filename": "tornado-couchdb-0.2.5.tar.gz", "has_sig": false, "md5_digest": "22ac1436580d867c487f917914dc98ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12257, "upload_time": "2015-03-22T18:35:59", "url": "https://files.pythonhosted.org/packages/00/aa/0f777c5a184b3ed0d1fb33cbcdfd263a769d31cfa331fe80360bcb1846f8/tornado-couchdb-0.2.5.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "4ec94c66b90a433ad4ff77471246850f", "sha256": "3101f663e8414e95f7c1d5ef3dde76b3573f63698ba3144da3a35a058fddfca1" }, "downloads": -1, "filename": "tornado_couchdb-0.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "4ec94c66b90a433ad4ff77471246850f", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 16206, "upload_time": "2015-06-05T10:55:16", "url": "https://files.pythonhosted.org/packages/e0/3c/b959df17d774cc08c5f520ae6c66a8df7488c9de7a6634a1999d75432ff3/tornado_couchdb-0.3.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e94258675c0626fa0f3e21823551d8f3", "sha256": "9d11e2876f43ee4b33cea8b5ab8726471fb225f928b52349a6be7788fd89edc1" }, "downloads": -1, "filename": "tornado_couchdb-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e94258675c0626fa0f3e21823551d8f3", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 16202, "upload_time": "2015-06-05T10:55:24", "url": "https://files.pythonhosted.org/packages/ed/64/4f8b1f6dcfda169720ebd9a426f61b82f433f9cb3f545733f58954ad9eee/tornado_couchdb-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d5e10e29e6e5fbba0d435bb250dc42e2", "sha256": "125b563f738ac49bce7029af1a7316654be0b46744b5b817e962d1b8ea1aba69" }, "downloads": -1, "filename": "tornado-couchdb-0.3.0.tar.gz", "has_sig": false, "md5_digest": "d5e10e29e6e5fbba0d435bb250dc42e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12267, "upload_time": "2015-06-05T10:51:36", "url": "https://files.pythonhosted.org/packages/21/ab/4dec152e8a315a70a6b9b48a40f1a09ce117605084cc9077a435f8d5a723/tornado-couchdb-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4ec94c66b90a433ad4ff77471246850f", "sha256": "3101f663e8414e95f7c1d5ef3dde76b3573f63698ba3144da3a35a058fddfca1" }, "downloads": -1, "filename": "tornado_couchdb-0.3.0-py2-none-any.whl", "has_sig": false, "md5_digest": "4ec94c66b90a433ad4ff77471246850f", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 16206, "upload_time": "2015-06-05T10:55:16", "url": "https://files.pythonhosted.org/packages/e0/3c/b959df17d774cc08c5f520ae6c66a8df7488c9de7a6634a1999d75432ff3/tornado_couchdb-0.3.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e94258675c0626fa0f3e21823551d8f3", "sha256": "9d11e2876f43ee4b33cea8b5ab8726471fb225f928b52349a6be7788fd89edc1" }, "downloads": -1, "filename": "tornado_couchdb-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e94258675c0626fa0f3e21823551d8f3", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 16202, "upload_time": "2015-06-05T10:55:24", "url": "https://files.pythonhosted.org/packages/ed/64/4f8b1f6dcfda169720ebd9a426f61b82f433f9cb3f545733f58954ad9eee/tornado_couchdb-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d5e10e29e6e5fbba0d435bb250dc42e2", "sha256": "125b563f738ac49bce7029af1a7316654be0b46744b5b817e962d1b8ea1aba69" }, "downloads": -1, "filename": "tornado-couchdb-0.3.0.tar.gz", "has_sig": false, "md5_digest": "d5e10e29e6e5fbba0d435bb250dc42e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12267, "upload_time": "2015-06-05T10:51:36", "url": "https://files.pythonhosted.org/packages/21/ab/4dec152e8a315a70a6b9b48a40f1a09ce117605084cc9077a435f8d5a723/tornado-couchdb-0.3.0.tar.gz" } ] }