{ "info": { "author": "Takeyuki UEDA", "author_email": "gde00107@nifty.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Programming Language :: Python", "Topic :: Terminals" ], "description": "# error-counter\nError Counter: Count error (e.g. network error) beyond process boundary, then issue fix command when exceeded threshold.\n\n## How to use\n\n```python:\nimport requests\nfrom error_counter import Counter\n\n# reboot system when error accumulate 3 times in a low\nnetwork_error_counter = Counter(\"/tmp/network_error.txt\")\n\ntry:\n\tr = requests.post(somowhere, somewhat)\nexcept requests.ConnectionError as e:\n\tnetwork_error_counter.inc_error()\n\nif not r is None:\n\t# send succeeded.\n\tnetwork_error_counter.reset_error()\n```\n\n## Counter class\n```python:\nclass Counter:\n def __init__(self, counterfile, reset_task=\"sudo reboot\", reset_threshold=3):\n\n# counterfile: file name to use counter. The file is owned jointly by sevelal Counter beyond process boundary.\n\n# reset_task: shell command which is issued when error count is over the threshold.\n\n# reset_threshold: Threshold for reset_task.\n\n def inc_error(self):\n #\tIncrement error count then issue reset_task if count is over threshold\n\n def dec_error(self):\n # Decrement error count as 0\n\n def reset_error(self):\n # Reset error count as 0\n```\n## downloads\n[![Downloads](https://pepy.tech/badge/error-counter)](https://pepy.tech/project/error-counter)\n[![Downloads](https://pepy.tech/badge/error-counter/month)](https://pepy.tech/project/error-counter)\n[![Downloads](https://pepy.tech/badge/error-counter/week)](https://pepy.tech/project/error-counter)\n\n## history\n- 0.1.0 2018.11.18 first version\n- 0.1.1 2018.11.18 fix README", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/UedaTakeyuki/error_counter", "keywords": "Counter,Error,Reset", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "error-counter", "package_url": "https://pypi.org/project/error-counter/", "platform": "", "project_url": "https://pypi.org/project/error-counter/", "project_urls": { "Homepage": "https://github.com/UedaTakeyuki/error_counter" }, "release_url": "https://pypi.org/project/error-counter/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Error Counter: Count error (e.g. network error) beyond process boundary, then issue fix command when exceeded threshold.", "version": "0.1.1" }, "last_serial": 4499087, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e35a036477fa800291c888a4f35b97f1", "sha256": "9a69ec08c43e868c15170c075caa918e20ce010831f6734484965166c82343d9" }, "downloads": -1, "filename": "error_counter-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e35a036477fa800291c888a4f35b97f1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2071, "upload_time": "2018-11-18T04:59:16", "url": "https://files.pythonhosted.org/packages/59/14/3d18d63799e17efeed0d0dba62446ef5b1312f7f5a8aaaa612982299b899/error_counter-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "049a5f452b9d859b853a449b6839e1d6", "sha256": "5da6a15fa7b1827d67b2d66b1f04a09c1467ba13b5444994dfcf57757a386f66" }, "downloads": -1, "filename": "error_counter-0.1.1.tar.gz", "has_sig": false, "md5_digest": "049a5f452b9d859b853a449b6839e1d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2085, "upload_time": "2018-11-18T06:04:53", "url": "https://files.pythonhosted.org/packages/07/05/a4bc3c90a85f38ddf236eb07be465cda718d6e0625715f03742c2a23af30/error_counter-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "049a5f452b9d859b853a449b6839e1d6", "sha256": "5da6a15fa7b1827d67b2d66b1f04a09c1467ba13b5444994dfcf57757a386f66" }, "downloads": -1, "filename": "error_counter-0.1.1.tar.gz", "has_sig": false, "md5_digest": "049a5f452b9d859b853a449b6839e1d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2085, "upload_time": "2018-11-18T06:04:53", "url": "https://files.pythonhosted.org/packages/07/05/a4bc3c90a85f38ddf236eb07be465cda718d6e0625715f03742c2a23af30/error_counter-0.1.1.tar.gz" } ] }