Reputation: 10315
Is anybody have working code or sample to update Twitter profile image .?
python-oauth2 is good or not .? Shall i use other library for this .. ?
Using : python 2.7 , Django 1.7 python-oauth2
image_post = "https://api.twitter.com/1.1/statuses/update.json?status=ThisOneWorksPerfectly"
resp, content = client.request(image_post, "POST")
Above code works perfectly fine but i changed that code to update
profile
image
( See below ... )
From this update_profile_image
image_post = "https://api.twitter.com/1.1/account/update_profile_image.json?image={}".format(encodedImage)
resp, content = client.request(image_post, "POST")
Error:
'{"errors":[{"message":"Could not authenticate you","code":32}]}'
Upvotes: 1
Views: 1608
Reputation: 54088
You should pass the image as a POST parameter, not as a query parameter. You can do so by providing a 3rd parameter (body
) to the client.request
method, as in:
image_post = "https://api.twitter.com/1.1/account/update_profile_image.json"
resp, content = client.request(image_post, "POST", "image=" + base64EncodedImage)
Upvotes: 1