Skip to content

Instantly share code, notes, and snippets.

@yankees714
Last active December 12, 2015 06:59
Show Gist options
  • Select an option

  • Save yankees714/4733453 to your computer and use it in GitHub Desktop.

Select an option

Save yankees714/4733453 to your computer and use it in GitHub Desktop.
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