Python script to monitor website changes
In this article, we are going to discuss how to create a python script to monitor website changes. You can code a program to monitor a website and it will notify you if there are any changes. This program has many useful scenarios for example if your school website has updated something you will come to know about it.
We will follow the following steps to write this program:
- Read the URL you want to monitor.
- Hash the entire website.
- Wait for a specified amount of seconds.
- If there are any changes as compared to the previous hash notify me else wait and again and then again take the hash.
Libraries we will be using are:
- time: To wait for a specified amount of time.
- hashlib: To hash the content of the entire website.
- urlib: To perform the get request and load the content of the website.
Note: time.sleep() takes seconds as a parameter. You can make changes for notification instead of printing the status on the terminal you can write a program to get an email.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course