{ "info": { "author": "Dan Pozmanter", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Testing" ], "description": "monitor requests\n================\n\n|Build Status| |PyPI|\n\nA tool to check for remote calls via the `requests`_ module.\n\nFind out which external apis your code is calling.\n\nOptionally:\n * Find where calls are taking place.\n * Capture the responses and response status codes.\n * Filter by domain\n * Run as a server for parallel tests\n\n**Usage**\n\n.. code:: python\n\n import unittest\n import monitor_requests\n from example import example_method\n\n class ExampleTestCase(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n cls.monitor = monitor_requests.Monitor()\n\n @classmethod\n def tearDownClass(cls):\n print('External calls for example:')\n # Optionally pass tracebacks=False to skip outputing tracebacks\n # Report will call .stop() by default.\n cls.monitor.report(tracebacks=False)\n\n def test_example_method(self):\n result = example_method()\n self.assertEqual(result.status_code, 200)\n\n if __name__ == 'main':\n unittest.main()\n\n\nTo filter what domains are captured:\n\n.. code:: python\n\n # Only capture facebook and google requests:\n monitor = monitor_requests.Monitor(\n domains=['facebook\\.com', 'google\\.com']\n )\n\nTo set this up inside a django test runner:\n(This will only work at the suite level if running tests in serial. Depending on your setup you may need to run with --parallel=1). Alternatively there are instructions further down on how to use `Server Moder` to push data asynchronously to an included `tornado`_ data server.\n\n.. code:: python\n\n def run_suite(self, suite, **kwargs):\n monitor = monitor_requests.Monitor()\n test_result = super(ReelioTestRunner, self).run_suite(suite, **kwargs)\n monitor.report()\n return test_result\n\nTo set up inside a py.test session fixture:\n\n.. code:: python\n\n @pytest.fixture(scope='session')\n def session_fixture():\n monitor = monitor_requests.Monitor()\n yield\n monitor.report()\n\nTo write to a file:\n\n.. code:: python\n\n @classmethod\n def tearDownClass(cls):\n with open('output.txt', 'w') as f:\n cls.monitor.report(output=f)\n\nFor finer tuned control over output:\n\n* Use `debug=True` to show urls, responses, and tracebacks.\n* Use `urls=True` to show urls.\n* Use `tracebacks=True` or `respones=True` to show tracebacks or responses (urls will be shown as well, as both tracebacks and responses are organized by url).\n\n***Server Mode***\n\nIf you want to activate monitor_requests for an entire test suite running parallel, you can run the included `tornado`_ server to persist request data:\n\n.. code:: bash\n\n monitor_requests_server --port=9003\n\n.. code:: python\n\n def run_suite(self, suite, **kwargs):\n # Make sure to turn off mocking at the suit or session level.\n monitor = monitor_requests.Monitor(server_port=9003, mock=False)\n test_result = super(ReelioTestRunner, self).run_suite(suite, **kwargs)\n monitor.report()\n return test_result\n\nYou will need to do additional calls in your TestCase classes:\n\n.. code:: python\n\n class ExampleTestCase(unittest.TestCase):\n\n @classmethod\n def setUpClass(cls):\n # Same port, and same domain filtering if applicable.\n cls.monitor = monitor_requests.Monitor(server_port=9003)\n\n @classmethod\n def tearDownClass(cls):\n # Make sure to stop the mocking in the tear down.\n cls.monitor.stop()\n\nNote that here there is no tearDownClass and no call to either stop() or report().\nThat only happens at the session level.\n\n**Installation**\n\n.. code:: bash\n\n pip install MonitorRequests\n\n**Example Output**\n\nWith `debug=True`:\n\n\n.. code:: text\n\n __________URLS__________\n\n __________URL________\n URL: http://facebook.com?param=test\n Requests: 1\n ______Tracebacks_____\n File \"example.py\", line 22, in \n run()\n File \"example.py\", line 18, in run\n get_function_fb()\n File \"example.py\", line 12, in get_function_fb\n return requests.get('http://facebook.com?param=test')\n _______Responses______\n 200\n \n Etc/Etc\n\n __________URL________\n URL: http://google.com\n Requests: 1\n ______Tracebacks_____\n File \"example.py\", line 22, in \n run()\n File \"example.py\", line 17, in run\n get_function()\n File \"example.py\", line 7, in get_function\n return requests.get('http://google.com')\n _______Responses______\n 200\n Etc/Etc\n\n ___________Analysis__________\n\n Total Requests: 2\n Time (Seconds): 1.16714\n URL Count: 2\n Domain Count: 2\n Domains: facebook.com, google.com\n\nWith `debug=False`:\n\n\n.. code:: text\n\n ___________Analysis__________\n\n Total Requests: 2\n Time (Seconds): 1.08454\n URL Count: 2\n Domain Count: 2\n Domains: facebook.com, google.com\n\n\n.. _requests: https://github.com/requests/requests\n.. _tornado: https://github.com/tornadoweb/tornado\n.. |Build Status| image:: https://travis-ci.org/danpozmanter/monitor_requests.svg?branch=master\n :target: https://travis-ci.org/danpozmanter/monitor_requests\n.. |PyPI| image:: https://img.shields.io/pypi/v/MonitorRequests.svg\n :target: https://pypi.python.org/pypi/MonitorRequests/\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/danpozmanter/monitor_requests", "keywords": "requests testing monitoring", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "MonitorRequests", "package_url": "https://pypi.org/project/MonitorRequests/", "platform": "", "project_url": "https://pypi.org/project/MonitorRequests/", "project_urls": { "Homepage": "https://github.com/danpozmanter/monitor_requests" }, "release_url": "https://pypi.org/project/MonitorRequests/1.2.5/", "requires_dist": null, "requires_python": "", "summary": "Check remote calls via request", "version": "1.2.5" }, "last_serial": 4487869, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "b374c9296206ca05a75c55d91d3a739f", "sha256": "5a3c82c044b9be31b9c94237c4163d3e63d56bc3305c0c8cddccbb2add3bd66a" }, "downloads": -1, "filename": "MonitorRequests-0.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b374c9296206ca05a75c55d91d3a739f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4802, "upload_time": "2017-06-26T00:08:37", "url": "https://files.pythonhosted.org/packages/65/8f/f3b320be880d8d3ef86e0e44c4b555cd54d7783af7cbe185d75b7fa5b175/MonitorRequests-0.0.0-py2.py3-none-any.whl" } ], "0.0.1": [ { "comment_text": "", "digests": { "md5": "e45595e5fee839d0093daad6461f9332", "sha256": "a4dcd07a55d2592f24cd73017cb153fd3a3bca85bc73288b7532fcc4e79e9303" }, "downloads": -1, "filename": "MonitorRequests-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e45595e5fee839d0093daad6461f9332", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4404, "upload_time": "2018-11-09T20:37:42", "url": "https://files.pythonhosted.org/packages/f4/bf/f7bfb9b57ab9df2fb55c2a030c0a1a94a3e528842e5df3547e4b8ea5e159/MonitorRequests-0.0.1-py2.py3-none-any.whl" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "9332316da0e0e8d3991fad21a461a77e", "sha256": "751a7681291afebdfdafb775f80d033a98b9a877666b2f31154a18fefa54d6eb" }, "downloads": -1, "filename": "MonitorRequests-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9332316da0e0e8d3991fad21a461a77e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4523, "upload_time": "2018-11-11T23:28:03", "url": "https://files.pythonhosted.org/packages/68/2b/8d2c37aeabda665afb11321f83f765f8293916c42470a6fcad063ed9cc4f/MonitorRequests-0.1.0-py2.py3-none-any.whl" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d4c2bde0093fb4472d452aa210579a17", "sha256": "6cdb535541fe14645041c829fb3c2408805b6698c66d73ed2572d12b5b4bb4d1" }, "downloads": -1, "filename": "MonitorRequests-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d4c2bde0093fb4472d452aa210579a17", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4766, "upload_time": "2018-11-12T00:08:35", "url": "https://files.pythonhosted.org/packages/cc/bd/4e0ac173bdc024612398eff7e88f2de06e02c5a401a073b626e6c4c22406/MonitorRequests-0.1.1-py2.py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "f313f93569205a996a632be9640364bf", "sha256": "27e9786494a27fa599711520dc3a02d9a5fcd164fa3dcf96b94ee521a6e78b51" }, "downloads": -1, "filename": "MonitorRequests-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f313f93569205a996a632be9640364bf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5360, "upload_time": "2018-11-12T06:07:03", "url": "https://files.pythonhosted.org/packages/41/76/ff939319fdad1b12f78c2b2fea740fcfa6cfcb517028106958b102d57350/MonitorRequests-0.2.0-py2.py3-none-any.whl" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "081d31be7d459324a86a642eaf75a8f6", "sha256": "b361953ac5d76a2153f24faa65fae2cb992ced2af7db4da9ae96238d7e6df35a" }, "downloads": -1, "filename": "MonitorRequests-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "081d31be7d459324a86a642eaf75a8f6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5609, "upload_time": "2018-11-12T17:15:00", "url": "https://files.pythonhosted.org/packages/2e/46/9678a2b6ee0e716ec83a2bf68becaa8731ee3210f3ea767cc4c84c5e16cc/MonitorRequests-0.3.0-py2.py3-none-any.whl" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "eaf444af720fe39a4ec08a46231194fd", "sha256": "afbd1a48a4962149c248ed67bac7eb30e991ab2bcd18c9746a43c4c0ae36b933" }, "downloads": -1, "filename": "MonitorRequests-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "eaf444af720fe39a4ec08a46231194fd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5641, "upload_time": "2018-11-12T21:11:01", "url": "https://files.pythonhosted.org/packages/9d/c7/2de72579e19781bc35fe319b6e72ed79932acb69540a81705a6038565958/MonitorRequests-0.3.1-py2.py3-none-any.whl" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "a130f64e63b9ca455a8340291b88a0cc", "sha256": "7bce00105ee07d388deeae955ba0470bd5d11551e6c118077d597c44e8effd1a" }, "downloads": -1, "filename": "MonitorRequests-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a130f64e63b9ca455a8340291b88a0cc", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8884, "upload_time": "2018-11-13T16:31:15", "url": "https://files.pythonhosted.org/packages/8a/f4/bf58f61d4f8e99ccbde418b5485f6a7cd2605b7c8e9be81a652c26ed66c3/MonitorRequests-1.0.0-py2.py3-none-any.whl" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "297f20f1cd7e7a0a6feecb6a55faab98", "sha256": "01a204b2ebedd4ded8092bdd70aa3161fbf5dd1f0f0c99d919ba44df1eea041b" }, "downloads": -1, "filename": "MonitorRequests-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "297f20f1cd7e7a0a6feecb6a55faab98", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8878, "upload_time": "2018-11-13T16:38:29", "url": "https://files.pythonhosted.org/packages/7f/f9/769a4193e6793558b5a9233f26e6b14982abaa227aeb888ac77b60e97c33/MonitorRequests-1.0.1-py2.py3-none-any.whl" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "6473f4ff8f767e5ec3e4a286b6e3b2a7", "sha256": "4bd159d27a9d21563788f76039a675a28e9f9281fcdd1190026ecd57a63fbd05" }, "downloads": -1, "filename": "MonitorRequests-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6473f4ff8f767e5ec3e4a286b6e3b2a7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9640, "upload_time": "2018-11-14T05:46:53", "url": "https://files.pythonhosted.org/packages/b8/d8/b7164c3144988edb72d8cb71173644d1509956974013a63133ef14438182/MonitorRequests-1.1.0-py2.py3-none-any.whl" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "8c8e7f3f0127f455ff421970cee5ec80", "sha256": "fbbb88cba355925cac9942edda7504c23634c8bb46c22399a822adb0db4cf74b" }, "downloads": -1, "filename": "MonitorRequests-1.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8c8e7f3f0127f455ff421970cee5ec80", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9783, "upload_time": "2018-11-14T06:39:10", "url": "https://files.pythonhosted.org/packages/ce/00/519bf98b173d3ce619a6af57ebc4139ecc1ca7379c378aade5212a357e6f/MonitorRequests-1.2.0-py2.py3-none-any.whl" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "bef25c9a223192b93d96766ed7c23fb6", "sha256": "4ff0141d6b72e6d788aa8f83e723d4459cde9edf785443365150d3899ff35185" }, "downloads": -1, "filename": "MonitorRequests-1.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bef25c9a223192b93d96766ed7c23fb6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9783, "upload_time": "2018-11-14T06:41:06", "url": "https://files.pythonhosted.org/packages/ec/bf/86af77f32c8038835e92ba0686676cd96b28e7f75771a71bdd3467b1f665/MonitorRequests-1.2.1-py2.py3-none-any.whl" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "5185cd486ba816f61b8283a1041e45ec", "sha256": "c177ab79f1442d2485a23faa15ca310d75e3fdc9abcb9337b18ef06faa99a8de" }, "downloads": -1, "filename": "MonitorRequests-1.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5185cd486ba816f61b8283a1041e45ec", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9786, "upload_time": "2018-11-14T06:55:45", "url": "https://files.pythonhosted.org/packages/fe/21/12297b0c442feac2069a0a82230be8a3a058d6875df1fd3efb879aefd4ff/MonitorRequests-1.2.2-py2.py3-none-any.whl" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "cb14c0786bd6b547506bd91cc0d14f74", "sha256": "b3ef850cad340a4df05451ef6d75109e8ca8a4a478a295350335ebdaee49cf0e" }, "downloads": -1, "filename": "MonitorRequests-1.2.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cb14c0786bd6b547506bd91cc0d14f74", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9786, "upload_time": "2018-11-14T07:40:13", "url": "https://files.pythonhosted.org/packages/da/11/adead8dcd63eedbe1c8d7fec71d343502c0ee1029a893a55491a8f611b64/MonitorRequests-1.2.3-py2.py3-none-any.whl" } ], "1.2.4": [ { "comment_text": "", "digests": { "md5": "51951db577995c1f4b4b60b8322d3603", "sha256": "a6366fe6404b6e5e86dfcaeb691ebafced577af286c8b01a9545a82de0778a4f" }, "downloads": -1, "filename": "MonitorRequests-1.2.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "51951db577995c1f4b4b60b8322d3603", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9798, "upload_time": "2018-11-14T21:43:10", "url": "https://files.pythonhosted.org/packages/71/36/6f31a086d82c722ced5e8d7610a1c3380d8c84d4f45a80fc59ca5fe3510e/MonitorRequests-1.2.4-py2.py3-none-any.whl" } ], "1.2.5": [ { "comment_text": "", "digests": { "md5": "026db911d2c8023af990f89d14840bae", "sha256": "1737f9eff3f945c082c1070072d1e53468cddc0f6265751924a9ae4dd8967941" }, "downloads": -1, "filename": "MonitorRequests-1.2.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "026db911d2c8023af990f89d14840bae", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9810, "upload_time": "2018-11-15T01:48:19", "url": "https://files.pythonhosted.org/packages/db/33/5f2a2174572c7ba26fd44d098c2dd9a2f1659bb1f099de7fa2b87417e9c2/MonitorRequests-1.2.5-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "026db911d2c8023af990f89d14840bae", "sha256": "1737f9eff3f945c082c1070072d1e53468cddc0f6265751924a9ae4dd8967941" }, "downloads": -1, "filename": "MonitorRequests-1.2.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "026db911d2c8023af990f89d14840bae", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9810, "upload_time": "2018-11-15T01:48:19", "url": "https://files.pythonhosted.org/packages/db/33/5f2a2174572c7ba26fd44d098c2dd9a2f1659bb1f099de7fa2b87417e9c2/MonitorRequests-1.2.5-py2.py3-none-any.whl" } ] }