Created
July 15, 2010 19:50
-
-
Save pandemicsyn/477433 to your computer and use it in GitHub Desktop.
posting media to posterous using python and pycurl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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