From f475e18d81c5302f20e92a4644aa7d03f21d0418 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sat, 10 Apr 2021 09:12:11 -0500 Subject: [PATCH] Update and improve documentation for API.update_profile Automatically use docstring for documentation Improve method and documentation order Add documentation for profile_link_color, include_entities, and skip_status parameters Improve documentation for name, url, location, and description parameters --- docs/api.rst | 15 ++------------- tweepy/api.py | 44 +++++++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index f984bb1..336f087 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -158,6 +158,8 @@ Manage account settings and profile .. automethod:: API.set_settings +.. automethod:: API.update_profile + Direct Message Methods ---------------------- @@ -238,19 +240,6 @@ Account Methods :rtype: :class:`User` object -.. method:: API.update_profile([name], [url], [location], [description]) - - Sets values that users are able to set under the "Account" tab of their - settings page. - - :param name: Maximum of 20 characters - :param url: Maximum of 100 characters. - Will be prepended with "http://" if not present - :param location: Maximum of 30 characters - :param description: Maximum of 160 characters - :rtype: :class:`User` object - - Block Methods ------------- diff --git a/tweepy/api.py b/tweepy/api.py index 4ce4aab..9d04926 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1879,6 +1879,39 @@ class API: ), use_cache=False, **kwargs ) + @payload('user') + def update_profile(self, **kwargs): + """update_profile(*, name, url, location, description, \ + profile_link_color, include_entities, skip_status) + + Sets values that users are able to set under the "Account" tab of their + settings page. + + :param name: Full name associated with the profile. + :param url: URL associated with the profile. Will be prepended with + ``http://`` if not present + :param location: The city or country describing where the user of the + account is located. The contents are not normalized or geocoded in + any way. + :param description: A description of the user owning the account. + :param profile_link_color: Sets a hex value that controls the color + scheme of links used on the authenticating user's profile page on + twitter.com. This must be a valid hexadecimal value, and may be + either three or six characters (ex: F00 or FF0000). + :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 + """ + return self.request( + 'POST', 'account/update_profile', endpoint_parameters=( + 'name', 'url', 'location', 'description', 'profile_link_color', + 'include_entities', 'skip_status' + ), **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 @@ -2145,17 +2178,6 @@ class API: ), files=files, **kwargs ) - @payload('user') - def update_profile(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/post-account-update_profile - """ - return self.request( - 'POST', 'account/update_profile', endpoint_parameters=( - 'name', 'url', 'location', 'description', 'profile_link_color', - 'include_entities', 'skip_status' - ), **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 -- 2.25.1