【文件属性】:
文件名称:python-hosts:用python编写的主机文件管理器库
文件大小:40KB
文件格式:ZIP
更新时间:2021-05-01 17:33:49
python hosts hostsfile Python
python主机
这是一个用于管理主机文件的python库。 它使您可以添加和删除条目,或从文件或URL导入它们。
文献资料
该文档托管在RTD上(请阅读以下文档): 。
安装
pip安装python-hosts
用法示例
将条目添加到主机文件
from python_hosts import Hosts, HostsEntry
hosts = Hosts(path='hosts_test')
new_entry = HostsEntry(entry_type='ipv4', address='1.2.3.4', names=['www.example.com', 'example'])
hosts.add([new_entry])
hosts.write()
通过URL导入主机条目列表
from python_hosts import Hosts
hosts = Hosts(path
【文件预览】:
python-hosts-devel
----MANIFEST.in(227B)
----test-requirements.txt(36B)
----.github()
--------workflows()
----LICENSE.txt(1KB)
----python_hosts()
--------hosts.py(19KB)
--------exception.py(1015B)
--------utils.py(2KB)
--------__init__.py(837B)
----shippable.yml(444B)
----compat-test-requirements.txt(42B)
----requirements.txt(13B)
----.travis.yml(1KB)
----tox.ini(964B)
----pytest.ini(125B)
----setup.cfg(40B)
----setup.py(2KB)
----README.md(2KB)
----docs()
--------make.bat(7KB)
--------conf.py(11KB)
--------usage.rst(505B)
--------python_hosts.hosts.rst(145B)
--------python_hosts.exception.rst(157B)
--------installation.rst(219B)
--------__init__.py(14B)
--------index.rst(325B)
--------Makefile(7KB)
--------python_hosts.rst(212B)
--------python_hosts.utils.rst(145B)
----tests()
--------test_hosts.py(27KB)
--------test_utils.py(1KB)
--------test_hosts_entry.py(2KB)
----.gitignore(796B)
----CHANGELOG.md(2KB)
----.coveragerc(138B)
----test_files()
--------hosts2(16KB)
--------hosts_win3(67B)
--------hosts_win2(2KB)
--------hosts(77B)
--------hosts_win(2KB)
--------hosts_invalid(52B)