Post to Tumblr with python
19.05.2013 by azarai in python
I have an art blog over at tumblr where i post my (almost) daily doodles. Usually i post them with the Tumblr UI, but lately i i got annoyed but that way and hacked something together to post images directly from my windows exlorer.
- Register an app at tumblr
- Install oauth2 and pytumblr
- Modify the “Twitter Three-legged OAuth Example” Script from python-oauth2 to use tumblr endpoints and insert your consumer key and secret
- Run the script and note the oauth token and secret the script outputs
My actual Poster Script (pretty less coe :-) ), add your keys and blog url here
import pytumblr import sys client = pytumblr.TumblrRestClient( '<consumer_key>', '<consumer_secret>', '<oauth_token>', '<oauth_secret>', ) client.create_photo("your blog url", state="published" , data=sys.argv)
Add Script to Windows Explorer context menu follwoing this tutorial
<path-to-python>python.exe <path_to_script>poster.py "%1"
Want content like this in your inbox each workday? No BS, spam or tricks... just useful content: