How to update profile Image?


Using : python 2.7 , Django 1.7 python-oauth2

image_post = ""
resp, content = client.request(image_post, "POST")

You know what i can see my status in Twitter ( So it’s working but … )

image_post = "{}".format(encodedImage)
resp, content = client.request(image_post, "POST")

Now i’m getting error

Could not authenticate you


Hi there!

I’m not 100% at first glance, but I’m not sure adding URL parameters on the image_post will work. You likely need to include encodedImage as POST request parameters.

The python-twitter project on github serves a similar purpose, and performs a file upload (search for UploadImage). It even performs the Base64 encoding for you.

FWIW,I use this project regularly, and I might suggest using it yourself.


Also, since you mentioned it was on Django, I added sample code that uses the python-twitter code base to show an profile image upload example. You can see it here:

The basic pieces you need are in this commit:

My example is loosely based on the following documentation:

Thanks, and let us know if you have other questions. (And pull requests greatly appreciated!)