{ "info": { "author": "Hong-She Liang", "author_email": "starofrainnight@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "============================\nhostsmgr (Hosts Manager)\n============================\n\n\n.. image:: https://img.shields.io/pypi/v/hostsmgr.svg\n :target: https://pypi.python.org/pypi/hostsmgr\n\n.. image:: https://img.shields.io/travis/starofrainnight/hostsmgr.svg\n :target: https://travis-ci.org/starofrainnight/hostsmgr\n\n.. image:: https://ci.appveyor.com/api/projects/status/lx6dwcisa6bolsqw?svg=true\n :target: https://ci.appveyor.com/project/starofrainnight/hostsmgr\n\n.. image:: https://readthedocs.org/projects/hostsmgr/badge/?version=latest\n :target: https://hostsmgr.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://pyup.io/repos/github/starofrainnight/hostsmgr/shield.svg\n :target: https://pyup.io/repos/github/starofrainnight/hostsmgr/\n :alt: Updates\n\n\nAPI for manage hosts file\n\n\n* Free software: Apache-2.0\n* Documentation: https://hostsmgr.readthedocs.io.\n\n\nFeatures\n--------\n\nUsage\n--------\n\n.. code:: python\n\n from hostsmgr import HostsMgr\n from hostsmgr.hostsmgr import guess_hosts_path\n from hostsmgr.conditions import Any, All, IPAddress, Host, InlineComment\n\n mgr = HostsMgr()\n\n # Load system hosts file\n mgr.load(guess_hosts_path())\n\n # Save hosts to another place (Must open with text mode !)\n mgr.save(open('/etc/hosts.old', 'w'))\n\n # Save hosts to string with hosts file format\n hosts_string = mgr.saves()\n\n # Find all hosts entries that with 127.0.0.1 address\n entries = mgr.find(IPAddress('127.0.0.1'))\n\n # Find all entries that contained specific host\n entries = mgr.find(Host('localhost'))\n\n # Find all entries that contained specificed ip address and host both\n entries = mgr.find(IPAddress('127.0.0.1') & Host('localhost'))\n\n # Find all entries that contained either hosts\n entries = mgr.find(Host('ip6-localhost') | Host('localhost'))\n\n # Find all entries that contained either hosts, another method\n entries = mgr.find(Any(Host('ip6-localhost'), Host('localhost')))\n\n # Find all entries that contained both hosts\n entries = mgr.find(Host('ip6-localhost') & Host('localhost'))\n\n # Find all entries that contained both hosts, another method\n entries = mgr.find(All(Host('ip6-localhost'), Host('localhost')))\n\n # Find all entries that contained target inline comment\n entries = mgr.find(InlineComment('THIS_IS_A_TAG'))\n\n # Find only one entry that contained target inline comment\n entries = mgr.find(InlineComment('THIS_IS_A_TAG'), at_most=1)\n\n # Remove an entry that found by find()\n mgr.remove(entry)\n\n # Remove all hosts from hosts entries\n mgr.remove_hosts(['localhost', 'ip6-localhost'])\n\n # Remove all entries by inline comment exactly matched\n mgr.remove_by_inline_comment(InlineComment('TAG_FOR_EXAMPLE'))\n\n # Remove all entries by inline comment partial matched\n mgr.remove_by_inline_comment(InlineComment('TAG_FOR_EXAMPLE', partial=True))\n\nCredits\n---------\n\nThis package was created with Cookiecutter_ and the `PyPackageTemplate`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`PyPackageTemplate`: https://github.com/starofrainnight/rtpl-pypackage\n\n\n\n=======\nHistory\n=======\n\n0.0.1 (2018-04-15)\n------------------\n\n* First release on PyPI.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/starofrainnight/hostsmgr", "keywords": "hosts,hostsmgr", "license": "Apache Software License", "maintainer": "", "maintainer_email": "", "name": "hostsmgr", "package_url": "https://pypi.org/project/hostsmgr/", "platform": "", "project_url": "https://pypi.org/project/hostsmgr/", "project_urls": { "Homepage": "https://github.com/starofrainnight/hostsmgr" }, "release_url": "https://pypi.org/project/hostsmgr/0.2.5/", "requires_dist": null, "requires_python": "", "summary": "API for manage hosts file", "version": "0.2.5" }, "last_serial": 3842838, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "29051102490494e442b541ba696e088e", "sha256": "fa9c2437dfc01cef56d0be13ec3bbbba218ec823383aa25fc8052db8104a77cc" }, "downloads": -1, "filename": "hostsmgr-0.1.0.tar.gz", "has_sig": false, "md5_digest": "29051102490494e442b541ba696e088e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17044, "upload_time": "2018-04-18T07:03:04", "url": "https://files.pythonhosted.org/packages/97/8b/ab966e5b548e4c1b880a354891002043f88da2df2807975927d774b667f9/hostsmgr-0.1.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "b83a73c74c193b5b41871b7f93ba2f96", "sha256": "8c80ca535ade641df23b0f098ec3b0397291876adfdaec18b88bbac19ee5f90c" }, "downloads": -1, "filename": "hostsmgr-0.2.1.tar.gz", "has_sig": false, "md5_digest": "b83a73c74c193b5b41871b7f93ba2f96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19231, "upload_time": "2018-04-19T07:27:02", "url": "https://files.pythonhosted.org/packages/43/09/d0dbf7c8d262272fb335a19e40319122fd57c8133a1798d4eaae75a5d8ff/hostsmgr-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "25f5f9ca42ffdee8c10ede1b50be7cd1", "sha256": "e4c1d6c72212b733e56c9db71381488168c395125c5d57c142b3b50e6b07cad7" }, "downloads": -1, "filename": "hostsmgr-0.2.2.tar.gz", "has_sig": false, "md5_digest": "25f5f9ca42ffdee8c10ede1b50be7cd1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20021, "upload_time": "2018-04-19T08:00:46", "url": "https://files.pythonhosted.org/packages/ea/5b/3bc666ce6b6d5d30db70ecf729570dc35955217d744adfd5b358a1a768cd/hostsmgr-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "0ba09856ccf272f7a3a23a0587c282f3", "sha256": "eff741e1d4baf9ee643385d619282b4b84912b9ea65a22af7def08da3d1cf99d" }, "downloads": -1, "filename": "hostsmgr-0.2.3.tar.gz", "has_sig": false, "md5_digest": "0ba09856ccf272f7a3a23a0587c282f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20306, "upload_time": "2018-04-19T08:31:43", "url": "https://files.pythonhosted.org/packages/a9/4b/302b09450f088e564d689800657b27951bcc6b826e2bbc4ad7788cc06b2f/hostsmgr-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "c51051520fd9be59337143e05fe9a94e", "sha256": "b1a042197eeecac6c156d2daa82d196aa59975611090f52f252c416a3ef41f40" }, "downloads": -1, "filename": "hostsmgr-0.2.4.tar.gz", "has_sig": false, "md5_digest": "c51051520fd9be59337143e05fe9a94e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20353, "upload_time": "2018-04-19T09:15:13", "url": "https://files.pythonhosted.org/packages/50/3e/21016a177602b8b02d17796aeea1ef6a42e54079aa01e85b809cf853cc8f/hostsmgr-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "d6636a3615d3d54dc6affc2d7c958047", "sha256": "f9b16c194af91ba945d3c191907161d280cc58f8c0395d3cbeeeca9f4f7e061c" }, "downloads": -1, "filename": "hostsmgr-0.2.5.tar.gz", "has_sig": false, "md5_digest": "d6636a3615d3d54dc6affc2d7c958047", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20420, "upload_time": "2018-05-08T02:28:30", "url": "https://files.pythonhosted.org/packages/7b/46/6809ed7f7717a334eb9ccd07161cd90676ebb8f99c9afa48a8518dc94c49/hostsmgr-0.2.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d6636a3615d3d54dc6affc2d7c958047", "sha256": "f9b16c194af91ba945d3c191907161d280cc58f8c0395d3cbeeeca9f4f7e061c" }, "downloads": -1, "filename": "hostsmgr-0.2.5.tar.gz", "has_sig": false, "md5_digest": "d6636a3615d3d54dc6affc2d7c958047", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20420, "upload_time": "2018-05-08T02:28:30", "url": "https://files.pythonhosted.org/packages/7b/46/6809ed7f7717a334eb9ccd07161cd90676ebb8f99c9afa48a8518dc94c49/hostsmgr-0.2.5.tar.gz" } ] }