Skip to content

Instantly share code, notes, and snippets.

@gthomas
Created May 10, 2012 17:23
Show Gist options
  • Save gthomas/2654567 to your computer and use it in GitHub Desktop.
Save gthomas/2654567 to your computer and use it in GitHub Desktop.
Post to Tumblr
from tumblr import Api as Tumblr
#your tumblr credentials go here
BLOG = 'sweetpictures.tumblr.com'
#email address or username should work here
USER = '[email protected]'
PASSWORD = 'mysecurepassword'
#basically, log in to Tumblr
api = Tumblr(BLOG, USER, PASSWORD)
#here's how you'd post a photo from the web to your tumblr
image_url = "http://www.mycoolwebserver.com/images/photo_i_just_took.jpg"
api.write_photo(image_url)
#here's how you'd post one from the filesystem
image_path = "/Users/me/Desktop/picture.jpg"
api.write_photo(image_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment