#!/usr/bin/env python

# Demonstration POST account/update_profile_image
# See https://dev.twitter.com/rest/reference/post/account/update_profile_image

from secret import twitter_instance
from json import dump
import sys

tw = twitter_instance()

# [1]
imagepath = "profile-image.png"
with open(imagepath, mode='rb') as fp:
    filedata = fp.read()

# [2]
response = tw.account.update_profile_image(image=filedata)

# [3]
dump(response, sys.stdout, ensure_ascii=False, indent=4, sort_keys=True)

#!/usr/bin/env python

# Demonstration POST account/update_profile_image
# See https://dev.twitter.com/rest/reference/post/account/update_profile_image

from secret import twitter_instance
from json import dump
import sys

tw = twitter_instance()

# [1]
imagepath = "profile-image.png"
with open(imagepath, mode='rb') as fp:
    filedata = fp.read()

# [2]
response = tw.account.update_profile_image(image=filedata)

# [3]
dump(response, sys.stdout, ensure_ascii=False, indent=4, sort_keys=True)

#!/usr/bin/env python # Demonstration POST account/update_profile_image # See https://dev.twitter.com/rest/reference/post/account/update_profile_image # [1] # [2] # [3]