• Stars
    star
    123
  • Rank 283,999 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a hosts file manager library written in python

python-hosts

codecov Docs

This is a python library for managing a hosts file. It enables you to add and remove entries, or import them from a file or URL.

Documentation

The docs are hosted on RTD (Read The Docs) here:
http://python-hosts.readthedocs.org/en/latest/index.html.

Installation

pip install python-hosts

Example usage

Adding an entry to a hosts file

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()

Importing a list of host entries by URL

from python_hosts import Hosts
hosts = Hosts(path='hosts_test')
hosts.import_url(url='https://gist.githubusercontent.com/jonhadfield/5b6cdf853ef629f9b187345d89157280/raw/ddfa4a069fb12bf3c1f285249d44922aeb75db3f/hosts')
hosts.write()

CLI

A command line client using python-hosts can be found here: https://github.com/jonhadfield/hostman

Requirements

Tested on python 2.7, 3.5, 3.6, 3.7, 3.8, 3.9, pypy and pypy3

License

MIT

More Repositories

1

awesome-standard-notes

A curated list of tools and information relating to Standard Notes.
775
star
2

soba

backup github, gitlab, bitbucket, azure devops, and gitea repositories
Go
118
star
3

sn-cli

a command line interface for standard notes
Go
71
star
4

puppet-wordpress

Puppet module to set up an instance of wordpress
Puppet
28
star
5

sn-dotfiles

sync and manage dotfiles with Standard Notes
Go
25
star
6

hostman

A hosts file manager
Python
23
star
7

ansible-lookups

Additional lookups for use with Ansible
Python
17
star
8

gosn-v2

Go
15
star
9

gosn

A go library for Standard Notes
Go
10
star
10

creds

Creds is a library for managing user accounts on Linux, FreeBSD and OpenBSD.
Python
9
star
11

sts

Simplify working with AWS STS credentials and MFA
Go
9
star
12

acli

An alternative CLI for AWS
Python
9
star
13

subtocheck

subdomain takeover checker
Go
7
star
14

ipscout

IP information for network administrators and security analysts.
Go
5
star
15

ape

AWS account scanner
Go
5
star
16

aws-inspector-reporter

an app to report AWS Inspector findings
Go
5
star
17

findexec

go library to find executables
Go
3
star
18

githosts-utils

a library for querying and backing up github, gitlab, gitea, and bitbucket repositories
Go
3
star
19

aws-ips

a utility to query the IP ranges published by AWS
Go
2
star
20

ip-fetcher

A library and CLI to fetch IP ranges from popular online sources
Go
1
star
21

taran

taran
Python
1
star
22

cheeseweb

website for ischeeseavegetable.com
HTML
1
star
23

sncli

1
star
24

ansible-elasticsearch

Ansible role to deploy elasticsearch
Shell
1
star
25

indicator-vpnc

A vpnc indicator
Python
1
star
26

aws_autoscaling_tutorial

This contains the ansible files that accompany the ansible tutorial on setting up an auto-scaling wordpress platform.
Python
1
star
27

docker-jenkins

Dockerfile to build jenkins container
Shell
1
star