From ae9ba0e09e2603564680c8e9058551d0c40b79f6 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 7 Apr 2021 10:59:43 -0500 Subject: [PATCH] Update and improve documentation for API.update_list Automatically use docstring for documentation Improve method and documentation order --- docs/api.rst | 21 ++------------------- tweepy/api.py | 38 +++++++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 3366fdb..c9c4002 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -106,6 +106,8 @@ Create and manage lists .. automethod:: API.unsubscribe_list +.. automethod:: API.update_list + User methods ------------ @@ -608,25 +610,6 @@ Search Methods provided by the API, and should not be modified. -List Methods ------------- - -.. method:: API.update_list(list_id/slug, [name], [mode], [description], \ - [owner_screen_name/owner_id]) - - Updates the specified list. - The authenticated user must own the list to be able to update it. - - :param list_id: |list_id| - :param slug: |slug| - :param name: The name for the list. - :param mode: |list_mode| - :param description: The description to give the list. - :param owner_screen_name: |owner_screen_name| - :param owner_id: |owner_id| - :rtype: :class:`List` object - - Trends Methods -------------- diff --git a/tweepy/api.py b/tweepy/api.py index 19919f0..8582333 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1354,6 +1354,33 @@ class API: ), **kwargs ) + @payload('list') + def update_list(self, **kwargs): + """update_list(*, list_id, slug, name, mode, description, \ + owner_screen_name, owner_id) + + Updates the specified list. + The authenticated user must own the list to be able to update it. + + :param list_id: |list_id| + :param slug: |slug| + :param name: The name for the list. + :param mode: |list_mode| + :param description: The description to give the list. + :param owner_screen_name: |owner_screen_name| + :param owner_id: |owner_id| + + :rtype: :class:`List` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-update + """ + return self.request( + 'POST', 'lists/update', endpoint_parameters=( + 'list_id', 'slug', 'name', 'mode', 'description', + 'owner_screen_name', 'owner_id' + ), **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 @@ -1930,17 +1957,6 @@ class API: """ return self.request('POST', f'saved_searches/destroy/{id}', **kwargs) - @payload('list') - def update_list(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-update - """ - return self.request( - 'POST', 'lists/update', endpoint_parameters=( - 'list_id', 'slug', 'name', 'mode', 'description', - 'owner_screen_name', 'owner_id' - ), **kwargs - ) - @payload('json') def trends_available(self, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/trends/locations-with-trending-topics/api-reference/get-trends-available -- 2.25.1