TechieYan Technologies

Block Websites Using Python

Abstract

As we all know, how click bait works and how trickster trick people in clicking irrelevant websites which makes users to redirect to a fraud website. Blocking websites can be useful to avoid unwanted distractions and stay focused on important tasks in a day. There are certain times when we face the need to block different websites on our system. This is where a Website Blocker helps us. We are going to create a website blocker using python which will allow us to block those websites. It also blocks the websites based on time period which makes easy to block and unblock websites at the specific times. The main aim of this project to stop interruptions of other websites while doing some important tasks that need no distractions. Apart from this feature this program also blocks websites at a specified time i.e., It will help us focus of a specific task for a given period of time while blocking all the other websites from your main websites.


Block Websites using python

Programming Methodology

  • We need to import datetime to perform any actions with time.
  • List all the sites you want to block
  • Give hosts path, the host path in the program is for windows . for any other OS you can get hosts path online.
  • After Setting date, time formats we sets time duration in which we want websites to remain blocked.

Now you can see my facebook website is running

 

you can see my facebook is running

Code Description & Execution

How to Execute?

 

Step 1 :

You need to open the jupyter notebook in the path directory on the anaconda prompt shell.

In my case

GUI Application for Calendar execution code

         To perform the above step you already need to have knowledge of installing jupyter notebook and running anaconda shell, if you don’t know how to install or run jupyter notebook check our previous articles about it.

Step 2 :

         Install required libraries

 

         In anaconda prompt type pip install –r requirement.txt

 

Step 3:

         Open py file by command python app.py

                                                                    

   Required libraries are written in code please refer.

OUTPUT

delete this

RESULT

cant reach website

This is true with all other websites in the program

When time laps finish the websites can be accessed again.

Issues you may face

  1. While giving right path in the Anaconda prompt shell to open jupyter notebook in correct directory.
  2. In getting hosts permission even if you are running your system as Administrator.

 

 

Note:

All the required data has been provided over here. Please feel free to contact me for model weights and if you face any issues.

https://techieyantechnologies.com/contact/

Yes, you now have more knowledge than yesterday, Keep Going.

Click Here To Download This Code And Associated File. 

 

+91 7075575787