From 27863b3825e922725bd384f7a5e22bf46dc7a985 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 7 Apr 2021 10:56:17 -0500 Subject: [PATCH] Update and improve documentation for API.unsubscribe_list Automatically use docstring for documentation Improve method and documentation order Improve parameter order in documentation --- docs/api.rst | 13 ++----------- tweepy/api.py | 31 +++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 7e2d843..3366fdb 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -104,6 +104,8 @@ Create and manage lists .. automethod:: API.subscribe_list +.. automethod:: API.unsubscribe_list + User methods ------------ @@ -625,17 +627,6 @@ List Methods :rtype: :class:`List` object -.. method:: API.unsubscribe_list(list_id/slug, [owner_id/owner_screen_name]) - - Unsubscribes the authenticated user from the specified list. - - :param list_id: |list_id| - :param slug: |slug| - :param owner_id: |owner_id| - :param owner_screen_name: |owner_screen_name| - :rtype: :class:`List` object - - Trends Methods -------------- diff --git a/tweepy/api.py b/tweepy/api.py index 5de5766..19919f0 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1333,6 +1333,27 @@ class API: ), **kwargs ) + @payload('list') + def unsubscribe_list(self, **kwargs): + """unsubscribe_list(*, list_id, slug, owner_screen_name, owner_id) + + Unsubscribes the authenticated user from the specified list. + + :param list_id: |list_id| + :param slug: |slug| + :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-subscribers-destroy + """ + return self.request( + 'POST', 'lists/subscribers/destroy', endpoint_parameters=( + 'list_id', 'slug', '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 @@ -1920,16 +1941,6 @@ class API: ), **kwargs ) - @payload('list') - def unsubscribe_list(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy - """ - return self.request( - 'POST', 'lists/subscribers/destroy', endpoint_parameters=( - 'list_id', 'slug', '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