Created
March 15, 2010 15:55
-
-
Save ustun/332975 to your computer and use it in GitHub Desktop.
How many days ago a web site was updated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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