From ba4248df34d05b1e1abf4a89759864282c3a7255 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 7 Apr 2021 10:54:16 -0500 Subject: [PATCH] Update and improve documentation for API.subscribe_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 19649c0..7e2d843 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -102,6 +102,8 @@ Create and manage lists .. automethod:: API.remove_list_members +.. automethod:: API.subscribe_list + User methods ------------ @@ -623,17 +625,6 @@ List Methods :rtype: :class:`List` object -.. method:: API.subscribe_list(list_id/slug, [owner_id/owner_screen_name]) - - Subscribes the authenticated user to 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 - - .. method:: API.unsubscribe_list(list_id/slug, [owner_id/owner_screen_name]) Unsubscribes the authenticated user from the specified list. diff --git a/tweepy/api.py b/tweepy/api.py index acb9661..5de5766 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1312,6 +1312,27 @@ class API: ), **kwargs ) + @payload('list') + def subscribe_list(self, **kwargs): + """subscribe_list(*, owner_screen_name, owner_id, list_id, slug) + + Subscribes the authenticated user to the specified list. + + :param owner_screen_name: |owner_screen_name| + :param owner_id: |owner_id| + :param list_id: |list_id| + :param slug: |slug| + + :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-create + """ + return self.request( + 'POST', 'lists/subscribers/create', endpoint_parameters=( + 'owner_screen_name', 'owner_id', 'list_id', 'slug' + ), **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 @@ -1899,16 +1920,6 @@ class API: ), **kwargs ) - @payload('list') - def subscribe_list(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create - """ - return self.request( - 'POST', 'lists/subscribers/create', endpoint_parameters=( - 'owner_screen_name', 'owner_id', 'list_id', 'slug' - ), **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 -- 2.25.1