Post to tumblr using vim

I wrote this script today morning before breakfast. It allows you to post to tumblr using the console. It’ll fire up vim to write a new post, and accepts markdown. If you don’t like vim, go away.

Here’s a snippet from the code. I’m testing out the new syntax highlighting system.

</p>

<h1>Instructions on how to use this file:</h1>

<h1>Step 1: set tumblr_email and password</h1>

<h1>Step 2: go to terminal, enter the two commands:</h1>

<h1>chmod +x tumblrpost.py</h1>

<h1>sudo cp tumblrpost.py /usr/bin</h1>

<h1>Step 3: Run tumblrpost.py from anywhere</h1>

<h1>You can use markdown to format your posts.</h1>

<h1>Ignore any errors. The post will still happen. Python seems to raise</h1>

<h1>errors with response code 201 is encountered</h1>

<h1>CHANGELOG:</h1>

<h1>==========</h1>

<h1>Version 0.1: Initial console version supporting regular posts</h1>

<p>import urllib, urllib2, os, subprocess</p>

<h1>TODO (user): SET THESE PARAMETERS</h1>

<p>tumblr_email = ''
tumblr_password = ''</p>

<p>if <strong>name</strong> == "<strong>main</strong>":</p>

<h1>Let's support only regular posts for now, but allow commandline</h1>

<h1>params to set post type later on. (like links, etc)</h1>

<p>post_type = 'regular'
if post_type == 'regular':
post_title=raw_input("Enter the title")</p>

<h1>Create a file for the body.</h1>

<p>filename = "post.txt"
editor = "vim"</p>

<p>
Anyways, you can see the full source code and download it here: http://code.google.com/p/proto-code-dump/source/browse/trunk/py/misc/tumblrpost.py

I’ll put my code on that repository, so if you want to get all my code, you can checkout the subversion repository:

http://proto-code-dump.googlecode.com/svn/trunk/

4 Responses to “Post to tumblr using vim”


Leave a Reply