.. automethod:: API.update_profile_banner
+.. automethod:: API.update_profile_image
+
Direct Message Methods
----------------------
:rtype: :class:`JSON` object
-.. method:: API.update_profile_image(filename)
-
- Update the authenticating user's profile image. Valid formats: GIF, JPG, or
- PNG
-
- :param filename: local path to image file to upload. Not a remote URL!
- :rtype: :class:`User` object
-
-
Block Methods
-------------
), files=files, **kwargs
)
+ @payload('user')
+ def update_profile_image(self, filename, *, file=None, **kwargs):
+ """update_profile_image(filename, *, file, include_entities, \
+ skip_status)
+
+ Update the authenticating user's profile image. Valid formats: GIF,
+ JPG, or PNG
+
+ :param filename: |filename|
+ :param file: |file|
+ :param include_entities: |include_entities|
+ :param skip_status: |skip_status|
+
+ :rtype: :class:`User` object
+
+ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image
+ """
+ if file is not None:
+ files = {'image': (filename, file)}
+ else:
+ files = {'image': open(filename, 'rb')}
+ return self.request(
+ 'POST', 'account/update_profile_image', endpoint_parameters=(
+ 'include_entities', 'skip_status'
+ ), files=files, **kwargs
+ )
+
def media_upload(self, filename, *, file=None, chunked=False,
media_category=None, additional_owners=None, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/overview
), use_cache=False, **kwargs
)
- @payload('user')
- def update_profile_image(self, filename, *, file=None, **kwargs):
- """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile_image
- """
- if file is not None:
- files = {'image': (filename, file)}
- else:
- files = {'image': open(filename, 'rb')}
- return self.request(
- 'POST', 'account/update_profile_image', endpoint_parameters=(
- 'include_entities', 'skip_status'
- ), files=files, **kwargs
- )
-
@payload('user')
def create_block(self, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-blocks-create