Skip to content

Instantly share code, notes, and snippets.

@pandemicsyn
Created July 15, 2010 19:50
Show Gist options
  • Select an option

  • Save pandemicsyn/477433 to your computer and use it in GitHub Desktop.

Select an option

Save pandemicsyn/477433 to your computer and use it in GitHub Desktop.
posting media to posterous using python and pycurl
#!/usr/bin/env python
#assumes youre posting to your default site
#other wise you need to add site_id
import pycurl
username="[email protected]"
password="urSuperSekritPassword"
file="/home/syn/Desktop/charts/nvda-05032010.png"
title="$nvda"
tags="nvda, chart, doji, more, tags"
body="blah blah blah this is the body of this post"
pconn = pycurl.Curl()
pconn.setopt(pconn.POST, 1)
pconn.setopt(pconn.URL, "http://posterous.com/api/newpost")
pconn.setopt(pconn.USERPWD, username + ":" + password)
pconn.setopt(pconn.HTTPPOST, [('title', title),('tags', tags),('body',
body),("media", (pconn.FORM_FILE, file))])
#pconn.setopt(pconn.VERBOSE, 1)
result = pconn.perform()
pconn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment