{ "info": { "author": "Wes Mason", "author_email": "wes@1stvamp.org", "bugtrack_url": null, "classifiers": [], "description": "trequests\n=========\n\n.. image:: https://travis-ci.org/1stvamp/trequests.png?branch=master\n\nA Tornado async HTTP/HTTPS client adapter for python-requests.\n\nThe problem\n-----------\n\nYou enjoy using `Tornado `_ to build fast non-blocking web applications, and you want to use a library from PyPI that makes a few HTTP requests, but pretty much every dev and their dog uses `Requests `_ to make HTTP requests (rightly so, because it's *awesome*), but requests has no knowledge of the event loop nor can it yield when a socket blocks, which means any time you try to use a library like that it begins to block your request handling and grud-knows what other worlds of pain.\n\nThe solution\n------------\n\nLuckily there are solutions, one such is to use the `greenlet `_ module to wrap blocking operations and swap Tornado coroutines at the right time, there is even the handy `tornalet `_ module which handles this for you.\n\nTo make life even easier, you lucky lucky people, I've created ``trequests``, an async Requests adapter which uses greenlets (via tornalet) and the inbuilt non-blocking HTTP client methos in Tornado, to make any call to a library (utilizing Requests) non-blocking.\n\nInstallation\n------------\n\n.. code-block:: bash\n \n $ pip install trequests\n \nUsage\n-----\n \n.. code-block:: python\n \n # Assume bobs_big_data uses python-requests for HTTP requests\n import bobs_big_data\n \n from tornado.web import RequestHandler\n from trequests import setup_session\n from tornalet import tornalet\n \n # Tell requests to use our AsyncHTTPadapter for the default\n # session instance, you can also pass you own through\n setup_session()\n \n class WebHandler(RequestHandler):\n @tornalet\n def get(self):\n data = {'foo': 'bar'}\n # This will now unblock the current coroutine, like magic\n response = bobs_big_data.BigData(data).post()\n return self.write(response)\n\n\nCaveats\n-------\n\n``trequests`` has been used in production in a large scale metrics application, and is a very small and quite simple module.\n\n**However** I've released it as ``0.9.x`` mainly because it's missing 100% compatibility with the Requests adapter API, most noticeably *cookie jar* and *session* support, which I will improve (or please send me a pull request if you fancy adding support), and release as a ``1.x`` branch when I have the time.\n\nAlso at the moment the ``setup_session`` utility actually monkey patches the ``session`` utility functions in Requests, as this was the only way I could see to override the mounts on \"default\" session instances (e.g. those created for every call when a session isn't provided). I'm hoping to change this in the future.", "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/1stvamp/trequests", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "trequests", "package_url": "https://pypi.org/project/trequests/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/trequests/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/1stvamp/trequests" }, "release_url": "https://pypi.org/project/trequests/0.9.5/", "requires_dist": null, "requires_python": null, "summary": "A Tornado async HTTP/HTTPS client adaptor for python-requests", "version": "0.9.5" }, "last_serial": 1165007, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "ba09fa002a28bd22232fb5870ab2a821", "sha256": "bfd93017de39b0085a0cbef5a9127be54a93372afdd699627e4c1ed2c7de84f0" }, "downloads": -1, "filename": "trequests-0.9.0.tar.gz", "has_sig": false, "md5_digest": "ba09fa002a28bd22232fb5870ab2a821", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2601, "upload_time": "2013-10-13T17:20:24", "url": "https://files.pythonhosted.org/packages/dc/42/e698ab59d5a26ac99b484115161964f3861350a478911b96a73fc6aad466/trequests-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "cb932a3aef83c3a640b73ab57a736fa0", "sha256": "cf8dd85f2ebf10d2142c0643748190fe931063baa03c76166aeab3d478abd8aa" }, "downloads": -1, "filename": "trequests-0.9.1.tar.gz", "has_sig": false, "md5_digest": "cb932a3aef83c3a640b73ab57a736fa0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2601, "upload_time": "2013-10-13T17:30:27", "url": "https://files.pythonhosted.org/packages/cd/0f/40bf7893fa74f0d7fc2f529e6fcde3060690ce06ddcd9a9d4f82c52e297a/trequests-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "93f8208bd586ea4a9c717451e4f40e6e", "sha256": "a6f0fa17d8c37213fccf3800a01414ccfb49107fef7ef8ea3627026736094cc8" }, "downloads": -1, "filename": "trequests-0.9.2.tar.gz", "has_sig": false, "md5_digest": "93f8208bd586ea4a9c717451e4f40e6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3527, "upload_time": "2013-10-16T09:24:11", "url": "https://files.pythonhosted.org/packages/9f/8c/65cacd326856000ee7a49932886f49e0cae856b72c2958c26d394923f77b/trequests-0.9.2.tar.gz" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "9a6ed9a970fae8518170e4dc315cd479", "sha256": "6f17a014ff2e80e28b4fc7a398471fdc557a324c245906151b8dee2cf687a8b8" }, "downloads": -1, "filename": "trequests-0.9.3.tar.gz", "has_sig": false, "md5_digest": "9a6ed9a970fae8518170e4dc315cd479", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3532, "upload_time": "2013-12-12T14:52:00", "url": "https://files.pythonhosted.org/packages/eb/fc/9a0d6d9918df0ee7238bcdb1c1dbab4e99037ab639ebbf5dac78a57ab276/trequests-0.9.3.tar.gz" } ], "0.9.4": [ { "comment_text": "", "digests": { "md5": "6c6b39f4e7ca9b460c21acf4ba4448a3", "sha256": "0c62f3c13d66c77bba8064962e4aed7697fb3f66bf905deae5eca7aacf3766f6" }, "downloads": -1, "filename": "trequests-0.9.4.tar.gz", "has_sig": false, "md5_digest": "6c6b39f4e7ca9b460c21acf4ba4448a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4450, "upload_time": "2014-01-04T13:29:56", "url": "https://files.pythonhosted.org/packages/be/be/a23de899b2f2762f02dd8320e34014d3536befee8dc337cedc0a1068e9fc/trequests-0.9.4.tar.gz" } ], "0.9.5": [ { "comment_text": "", "digests": { "md5": "ea19107c1e0f2319a70ec2675c397bc0", "sha256": "f2c151294fac2c604f26ea82c2c783dd1bc4c7085544540d7a0dcc88f3d2a9a9" }, "downloads": -1, "filename": "trequests-0.9.5.tar.gz", "has_sig": false, "md5_digest": "ea19107c1e0f2319a70ec2675c397bc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4476, "upload_time": "2014-07-22T02:53:51", "url": "https://files.pythonhosted.org/packages/80/c0/27f8335bbd47d1c026ad3bb838c216e4e6f26cab8443c4045fc6f954b29d/trequests-0.9.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ea19107c1e0f2319a70ec2675c397bc0", "sha256": "f2c151294fac2c604f26ea82c2c783dd1bc4c7085544540d7a0dcc88f3d2a9a9" }, "downloads": -1, "filename": "trequests-0.9.5.tar.gz", "has_sig": false, "md5_digest": "ea19107c1e0f2319a70ec2675c397bc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4476, "upload_time": "2014-07-22T02:53:51", "url": "https://files.pythonhosted.org/packages/80/c0/27f8335bbd47d1c026ad3bb838c216e4e6f26cab8443c4045fc6f954b29d/trequests-0.9.5.tar.gz" } ] }