Last active
December 12, 2015 06:59
-
-
Save yankees714/4733453 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import urllib | |
| from datetime import datetime | |
| blog= raw_input("blog name: ") | |
| if ".tumblr.com" not in blog: | |
| blog = blog+".tumblr.com" | |
| url ="http://api.tumblr.com/v2/blog/" + blog +"/info?api_key=H7sBfGGtuNcTds7SM58iXxSmkeUNXk5DP7k7L54AZMsa6hjPDX" | |
| info = urllib.urlopen(url) | |
| info = info.readline() | |
| info=info.split(",") | |
| if int(info[0].split(":")[2]) != 200: | |
| print "not a valid blog name" | |
| exit(0) | |
| updated = int(info[6].split(":")[1]) | |
| updated =datetime.fromtimestamp(updated) | |
| current = datetime.today() | |
| tumbled = 0 | |
| while not tumbled: | |
| if updated.month == current.month and updated.day == current.day: | |
| if updated.hour > 4: | |
| print "Tumbled today!" | |
| tumbled=1 | |
| else: | |
| current = datetime.today() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment