Skip to content

Instantly share code, notes, and snippets.

@fanzeyi
Created June 29, 2011 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanzeyi/1053812 to your computer and use it in GitHub Desktop.
Save fanzeyi/1053812 to your computer and use it in GitHub Desktop.
upload picture to tumblr
#!/usr/bin/python
import urllib2_file
import urllib2
import sys
path = sys.argv[1]
text = "".join(sys.argv[2:])
data = {}
data['email'] = 'username@gmail.com'
data['password'] = 'password'
data['type'] = 'photo'
data['data'] = open(path)
data['caption'] = text
try:
u = urllib2.urlopen('http://www.tumblr.com/api/write', data)
except urllib2.HTTPError:
print "Msg Sent"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment