Code Monkey home page Code Monkey logo

python-website-blocker's Introduction

Python Website Blocker

Focus on your work by blocking your favorite productivity killers.

Features

This Python script blocks certain websites from being accessed. You can customize the URLs you want to block by editing blocklist.txt.

How to Install

The Python Website Blocker currently only works for Windows. Download blocker.py, pomodoro.py and blocklist.txt and place them in the same directory. You can pip install win10toast for nice Windows notifications from. But you don't have to, notifications are also printed in your command line tool.

How to run

To run the block script, you have to run your command line tool with administrator privileges. To block websites:

cd /your/directory/
python blocker.py

To unblock all websites:

python blocker.py unblock

How to Run Pomodoro Timer

The Pomodoro feature blocks your defined websites for 25 minutes. It notifies you after the 25 minutes are over and gives you access to all websites for 5 minutes (although I recommend getting up and stretching instead ๐Ÿ™‚). This cycle is repeated 4 times. You have to run your command line tool with administrator privileges.

python pomodoro.py

Behind the Scenes

The script blocks URLs by modifying the hosts file. Blocked URLs are redirected to 127.0.0.1. The script backs up the original hosts file, you will not lose any customizations and you can always reset to the original state.

To Do

  • Turn script into installable Python package
  • extend to Linux and MacOS
  • Add ability to schedule or block for specific period of time

python-website-blocker's People

Contributors

johannesstutz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.