{ "info": { "author": "xsren", "author_email": "bestrenxs@gmail.com", "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\nTests\n-----\n\nTo run the basic testsuite hit up `python setup.py test`.\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.\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/xsren/trequests", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "trequests_xsren", "package_url": "https://pypi.org/project/trequests_xsren/", "platform": "", "project_url": "https://pypi.org/project/trequests_xsren/", "project_urls": { "Homepage": "https://github.com/xsren/trequests" }, "release_url": "https://pypi.org/project/trequests_xsren/1.0.3/", "requires_dist": null, "requires_python": "", "summary": "A Tornado async HTTP/HTTPS client adaptor for python-requests. Forked from https://github.com/1stvamp/trequests .", "version": "1.0.3" }, "last_serial": 3041045, "releases": { "0.9.5": [ { "comment_text": "", "digests": { "md5": "4bb2ed423cd5ff868115179261027c85", "sha256": "63fbe24c5b8dc359ebbf77bb95d9ecdde13f95953e6b84134e5e0cc814e168d0" }, "downloads": -1, "filename": "trequests_xsren-0.9.5-py2-none-any.whl", "has_sig": false, "md5_digest": "4bb2ed423cd5ff868115179261027c85", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6359, "upload_time": "2017-07-21T08:10:15", "url": "https://files.pythonhosted.org/packages/54/05/2c59dd5b8c85730a10d25602ce3fb702ff2ab3d6077e86f44ee7170e3b16/trequests_xsren-0.9.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "121fafa3606ee737be8a2cbbb7c9f813", "sha256": "f84ca0aba0c4d26d43d0a15caae8d0dbf061625594d96920d99791e170ba73dd" }, "downloads": -1, "filename": "trequests_xsren-0.9.5.tar.gz", "has_sig": false, "md5_digest": "121fafa3606ee737be8a2cbbb7c9f813", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4839, "upload_time": "2017-07-21T08:10:12", "url": "https://files.pythonhosted.org/packages/9f/44/8d1af434f89627a0e7543ecc6f126d366d1543e5373e5f3453c04bd66122/trequests_xsren-0.9.5.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "79871a4b917d0c482740a1c77e3db80b", "sha256": "52921758c432bd987846d92eee661ee5cea3b79cfd50800b85de1c0bd613d49e" }, "downloads": -1, "filename": "trequests_xsren-1.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "79871a4b917d0c482740a1c77e3db80b", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6486, "upload_time": "2017-07-22T04:28:12", "url": "https://files.pythonhosted.org/packages/6f/06/00fea2ce3a5c33916950b00eb52dfe438f595867f2877ca7a86ee1410a0d/trequests_xsren-1.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e46dcd6aa65c85c3ac85b0de4e2bfdc1", "sha256": "0b8af37c9e5cd5952c2d9a15d87acd3133fc9d79d6ac48126b5c56dd0883a424" }, "downloads": -1, "filename": "trequests_xsren-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e46dcd6aa65c85c3ac85b0de4e2bfdc1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4969, "upload_time": "2017-07-22T04:28:08", "url": "https://files.pythonhosted.org/packages/ac/d2/3887c2a1c02b08a37438a9f8092e57f14d9bb8f5a392b788c3036692b3d2/trequests_xsren-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "4af44cd7c57cbcd4838551c92211158b", "sha256": "8236a49b2d1b13bc9da58a783c80bf4e7e3b5812baa9d85c6f7034254edec4ff" }, "downloads": -1, "filename": "trequests_xsren-1.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "4af44cd7c57cbcd4838551c92211158b", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6486, "upload_time": "2017-07-22T05:54:00", "url": "https://files.pythonhosted.org/packages/3e/06/81724593ec517b1f8a52e59c1b1a211cf26db17c1035af3377725d2ef390/trequests_xsren-1.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "23483116408b90a40ad883d1afddf8e7", "sha256": "6a7c3998392f0ea228d2357bcc8be9621ed3484885edd58d34ed86a67470cd08" }, "downloads": -1, "filename": "trequests_xsren-1.0.1.tar.gz", "has_sig": false, "md5_digest": "23483116408b90a40ad883d1afddf8e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4976, "upload_time": "2017-07-22T05:53:22", "url": "https://files.pythonhosted.org/packages/75/1c/1978da8af80bf18811201e1b3006841417784aafd9a14f4f9854a6de804c/trequests_xsren-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "abb9c941cec7879695bfd2e7c8defc5a", "sha256": "162d890f81b14074d710d9c457f7fa807693b5c9e08b2cec8805bed4ab29140b" }, "downloads": -1, "filename": "trequests_xsren-1.0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "abb9c941cec7879695bfd2e7c8defc5a", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6499, "upload_time": "2017-07-22T06:04:48", "url": "https://files.pythonhosted.org/packages/ba/0f/c4fc6ee530d5734ae025144c7a6aa2d53307259d93d1eae0d33e95ab95dc/trequests_xsren-1.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6429e8a5db417b5a57b0149e1bebcba2", "sha256": "608b0afd4d25fd5a7e80776543a338789d61c0df1a978ec252434cde42ac269f" }, "downloads": -1, "filename": "trequests_xsren-1.0.2.tar.gz", "has_sig": false, "md5_digest": "6429e8a5db417b5a57b0149e1bebcba2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4980, "upload_time": "2017-07-22T06:03:35", "url": "https://files.pythonhosted.org/packages/f7/76/c208afef353c8c911a616a47cc7238fc622c7f889c351c967b2fab091747/trequests_xsren-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "d0aa89834905560b17bf9730fc90276b", "sha256": "4cf679e6a938287715e1edd3adc00ade408571fcc71e407be6e04a8c3160de87" }, "downloads": -1, "filename": "trequests_xsren-1.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "d0aa89834905560b17bf9730fc90276b", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6485, "upload_time": "2017-07-22T06:28:13", "url": "https://files.pythonhosted.org/packages/8f/98/d7ff39d7ae0ce246f626a1026e20a18f190359980ddf13bb6e59297c030d/trequests_xsren-1.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "174e5531378aa463535ff1db5a2b2b1b", "sha256": "174497945fb0aa4a7aa93e30da17f0f2f46ee8645543e116dba60509a4277e6b" }, "downloads": -1, "filename": "trequests_xsren-1.0.3.tar.gz", "has_sig": false, "md5_digest": "174e5531378aa463535ff1db5a2b2b1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4970, "upload_time": "2017-07-22T06:28:10", "url": "https://files.pythonhosted.org/packages/b0/bd/5dc4d54fd428e95dfcce0e317c4bb70cc2b3c222d05e609e3b26bce74311/trequests_xsren-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d0aa89834905560b17bf9730fc90276b", "sha256": "4cf679e6a938287715e1edd3adc00ade408571fcc71e407be6e04a8c3160de87" }, "downloads": -1, "filename": "trequests_xsren-1.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "d0aa89834905560b17bf9730fc90276b", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6485, "upload_time": "2017-07-22T06:28:13", "url": "https://files.pythonhosted.org/packages/8f/98/d7ff39d7ae0ce246f626a1026e20a18f190359980ddf13bb6e59297c030d/trequests_xsren-1.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "174e5531378aa463535ff1db5a2b2b1b", "sha256": "174497945fb0aa4a7aa93e30da17f0f2f46ee8645543e116dba60509a4277e6b" }, "downloads": -1, "filename": "trequests_xsren-1.0.3.tar.gz", "has_sig": false, "md5_digest": "174e5531378aa463535ff1db5a2b2b1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4970, "upload_time": "2017-07-22T06:28:10", "url": "https://files.pythonhosted.org/packages/b0/bd/5dc4d54fd428e95dfcce0e317c4bb70cc2b3c222d05e609e3b26bce74311/trequests_xsren-1.0.3.tar.gz" } ] }