Skip to main content

A simple Python module to block websites.

Project description

web_block

A simple Python module to block websites.
It configures the hosts file (/etc/hosts on macOS or Linux and C:\Windows\System32\drivers\etc\hosts on Windows) to redirect a website passed in as an argument to localhost (127.0.0.1), essentially blocking it.

PyPI here: https://pypi.org/project/web-block

Usage:

Blocking websites

import web_block
web_block.block("example.com example.org") # Use spaces to separate websites.

It's as simple as that.

Unblocking websites

import web_block
web_block.unblock("example.com example.org") # You can also use `https://www.example.com/abcd.html` and it will automatically get the domain for you.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

web_block-1.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

web_block-1.0.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file web_block-1.0.0.tar.gz.

File metadata

  • Download URL: web_block-1.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for web_block-1.0.0.tar.gz
Algorithm Hash digest
SHA256 570e0613d758446f12eb25c96c8ee10a21f6ce5a4663d1a87dd181e947de0e40
MD5 e8d7d7cab69d12a69c2a42b0d0d31120
BLAKE2b-256 4a1472d7e6029b1804895ec0a5e5a9bf56d3b9c8979e9cad3ca914deaaf3424b

See more details on using hashes here.

File details

Details for the file web_block-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: web_block-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for web_block-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45e4e5c3f8efa21a76db131877cb33a63dfc344bf2df7fea61e4e792b1615da9
MD5 082b1993b969fea24a1adc202e9bbeef
BLAKE2b-256 8fb702f6e9e4f1a2d2743ed1aac88cd4c5b5b7d7e8b2706be2f1e0289da95f28

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page