>From looking at the archives of this group, uploading images to
Twitter seems to be a common source of problems. I've found a couple
of posts describing the exact same problem I have, but without
resolution. (e.g.
http://groups.google.com/group/twitter-development-talk/browse_thread/thread/6f1e68dabd00e6dd/a1b4998519642350?lnk=gst&q=update_profile_image#a1b4998519642350
and
http://groups.google.com/group/twitter-development-talk/browse_thread/thread/df48afe3ff0a61b7/30b6b8ae158209c6?lnk=gst&q=update_profile_image#30b6b8ae158209c6
for example). So here is another attempt, with a dump of the wire
traffic in case anyone can spot the problem.

My request:

*******************************

POST /1/account/update_profile_image.xml HTTP/1.1
Accept-Encoding: identity
Content-Length: 118492
Host: api.twitter.com:80
User-Agent: Python-urllib/2.6
Connection: close
Content-Type: multipart/form-data;
boundary=670d0073732c41d9a8023cc1ff8f563b
Authorization: Basic (...)

--670d0073732c41d9a8023cc1ff8f563b
Content-Disposition: form-data; name="image"; filename="test.jpg"
Content-Type: image/jpeg
Content-Length: 118295

<file content>
--670d0073732c41d9a8023cc1ff8f563b--

*******************************

The response I get:

*******************************

HTTP/1.1 500 Internal Server Error
Date: Thu, 25 Mar 2010 06:11:51 GMT
Server: hi
Status: 500 Internal Server Error
Content-Type: text/html; charset=UTF-8
Cache-Control: max-age=300
Expires: Thu, 25 Mar 2010 06:16:51 GMT
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked

f4
Status: 500 Internal Server Error
Content-Type: text/html

<html><body><h1>500 Internal Server Error</h1></body></html>Status:
500 Internal Server Error
Content-Type: text/html

<html><body><h1>500 Internal Server Error</h1></body></html>
0

*******************************

It's not a copy/paste error, the body (and a couple of HTTP headers)
appear twice. Go figure.

I can't see the pb w/ the headers and how the response is structured.

My guess is that there might be something about the images themselves
and the way they're encoded. But I've tried several of them (JPG, PNG
and GIF) with the same result. They are all reasonably sized and work
just fine it I upload them directly via the Web interface.

As you can tell from the user agent in the dump above, my code is in
Python 2.6, with the help of the Poster (http://pypi.python.org/pypi/
poster/0.5) library to do the multi-part stuff. But I am not asking
for Python assistance, more on-the-wire compatibility assistance.

To unsubscribe from this group, send email to 
twitter-development-talk+unsubscribegooglegroups.com or reply to this email 
with the words "REMOVE ME" as the subject.

Reply via email to