This Python script sends email notifications whenever it detects a change to the content of the URLs it is configured to monitor. The script makes use of queries for HTTP queries and BeautifulSoup for site scraping. The list named urls_to_monitor
contains the URLs that are being watched.
-
Make a repository clone.
In a shell, type
git clone https://github.com/your-username/website-change-detector.git
. -
Set Up Requirements.
pip install -r requirements.txt
-
If you have not previously, activated two-step verification for your Google Account at https://myaccount.google.com/u/1/security.
-
Create Password for App:
- Go to the "App passwords" area at https://myaccount.google.com/u/1/apppasswords after turning on Two-Step Verification.
- Give your program a name (Website Change Detector, for example).
- Select "Create" from the menu.
- An app password will be generated by Google. Make a note of the password.
-
Edit the file
env.py
:-
There will be a file called
env.py
in the root of your project. -
Replace "insert the password here that you copied" with the app password and add this code:
# env.py # App password generated for Gmail password = ""
-
-
Set Up URLs for Monitoring:
- Start
main.py
. - In the
urls_to_monitor
list, add the URLs you wish to keep an eye on.
- Start
-
Execute the script by typing
python main.py
- Paste the app password into the
password
variable in theenv.py
file, enclosing it in quotes. - Make sure the app password is stored securely and is not accessible to the public in the
env.py
file.
Please feel free to modify the script to suit your needs and use case.