You are not logged in.
Pages: 1
http://pastebin.isawsome.net/pastebin.php?show=366
I'm trying to get a POST together to upload a local file to the tumblr api (tumblr.com). I keep getting Authorization Failed. I'm thinking it could be the header, or maybe a malformed URL (but that looks ok to me).
Anyways, code is above and below. I can't seem to find much documentation, so I figured I'd give the ol' BBS a shot.
def upvid(self):
password = self.password
email = self.email
BOUNDARY = 'bOn3dkjlDr3Y'
CRLF = '\r\n'
files = '/home/dude/warn.wav'
f=file('/home/dude/warn.wav')
fvalue = f.read()
ctype = mimetypes.guess_type(files)
L = []
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="files"; filename="%s"' % (files))
L.append('Content-Type: %s' %(ctype[0]))
L.append('')
L.append(fvalue)
L.append('--' + BOUNDARY + '--')
L.append('')
#body = CRLF.join(L)
body = ''.join(L)
values = {
'data' : body,
'type' : 'audio',
'password' : self.password,
'email' : self.email
}
values=urllib.urlencode(values)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
h = httplib.HTTPConnection(self.url)
headers = {'Content-Type': content_type }
h.follow_all_redirects = True
h.request('POST', '/api/write', values, headers)
print values
res = h.getresponse()
print res.status, res.reason, res.read()
There's no place like 127.0.0.1
Offline
Huzzah for google---
Offline
the code seems fine at a quick glance,
i checked using a web browser(GET) and it returns the same thing regardless of what input or lack thereof
i'm going to guess this is a problem with tumblr
Offline
Pages: 1