Created
June 29, 2011 13:22
-
-
Save fanzeyi/1053812 to your computer and use it in GitHub Desktop.
upload picture to tumblr
This file contains 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/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