Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ustun/332975 to your computer and use it in GitHub Desktop.
Save ustun/332975 to your computer and use it in GitHub Desktop.
How many days ago a web site was updated
#!/usr/bin/env python
import urllib
from datetime import datetime
response = urllib.urlopen("http://www.bilkent.edu.tr/~kafemud/monu_tr.html")
headers = response.info()
lastchangedDate = datetime.strptime(headers["date"],"%a, %d %b %Y %H:%M:%S %Z")
today = datetime.today()
dayDifference = abs((today-lastchangedDate).days)
if dayDifference > 2:
# old data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment