Python: Merge Multiple PDFs into One
Merge several PDF files into one with Python in a few lines — keep the page order you choose.
Watch a web page with Python and get an alert when its text changes — track prices, results and announcements.
23 lines · Updated Nov 26, 2026
import hashlib
import time
import requests
def page_hash(url):
response = requests.get(url, headers={
"User-Agent": "ChangeMonitor/1.0 (learning project)",
}, timeout=15)
response.raise_for_status()
return hashlib.sha256(response.text.encode()).hexdigest()
if __name__ == "__main__":
url = "https://example.com/results"
last = page_hash(url)
print("Watching", url)
while True:
time.sleep(300) # check every 5 minutes
current = page_hash(url)
if current != last:
print("PAGE CHANGED:", url)
last = current
else:
print("No change.")
Waiting for a results page, a job listing, a product restock or a government notice? Instead of refreshing it every hour, let Python do it. This snippet checks a web page on a schedule, compares it with the previous version and alerts you when the content changes.
requests, and beautifulsoup4 if you target part of a page).cron or Task Scheduler every 15–60 minutes.robots.txt.Can it monitor prices? Yes — extract the price element and compare numbers instead of hashes.
Related: 10 Python automation projects · Retry with backoff
Run the script and leave it running, or schedule it with cron. Change the URL and the sleep time to suit the page. Add the Telegram snippet from this collection to get the alert on your phone.
Share this snippet
Merge several PDF files into one with Python in a few lines — keep the page order you choose.
Read the text out of any PDF with Python — the first step for search, summaries and automation.
Send yourself a Telegram message from Python — free alerts for scripts, servers and price trackers.