From: Harmon Date: Tue, 6 Apr 2021 19:01:58 +0000 (-0500) Subject: Update and improve documentation for API.user_timeline X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=239241b3cef9df3b86db6b5d3baca4ea305c4f22;p=tweepy.git Update and improve documentation for API.user_timeline Automatically use docstring for documentation Improve method and documentation order --- diff --git a/docs/api.rst b/docs/api.rst index 00d7081..211f5e4 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -23,6 +23,8 @@ Timeline methods .. automethod:: API.mentions_timeline +.. automethod:: API.user_timeline + .. method:: API.statuses_lookup(id_, [include_entities], [trim_user], [map_], \ [include_ext_alt_text], [include_card_uri]) @@ -38,30 +40,6 @@ Timeline methods :param include_card_uri: |include_card_uri| :rtype: list of :class:`Status` objects - -.. method:: API.user_timeline([user_id/screen_name], [since_id], [count], \ - [max_id], [trim_user], [exclude_replies], \ - [include_rts]) - - Returns the 20 most recent statuses posted from the authenticating user or - the user specified. It's also possible to request another user's timeline - via the id parameter. - - :param user_id: |user_id| - :param screen_name: |screen_name| - :param since_id: |since_id| - :param count: |count| - :param max_id: |max_id| - :param trim_user: |trim_user| - :param exclude_replies: |exclude_replies| - :param include_rts: When set to ``false``, the timeline will strip any - native retweets (though they will still count toward both the maximal - length of the timeline and the slice selected by the count parameter). - Note: If you're using the trim_user parameter in conjunction with - include_rts, the retweets will still contain a full user object. - :rtype: list of :class:`Status` objects - - .. method:: API.retweets_of_me([since_id], [max_id], [count], [page]) Returns the 20 most recent tweets of the authenticated user that have been diff --git a/tweepy/api.py b/tweepy/api.py index 012bc1c..43a6453 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -303,21 +303,33 @@ class API: ), **kwargs ) - @payload('status', list=True) - def statuses_lookup(self, id, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-lookup - """ - return self.request( - 'GET', 'statuses/lookup', endpoint_parameters=( - 'id', 'include_entities', 'trim_user', 'map', - 'include_ext_alt_text', 'include_card_uri' - ), id=list_to_csv(id), **kwargs - ) - @pagination(mode='id') @payload('status', list=True) def user_timeline(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/timelines/api-reference/get-statuses-user_timeline + """user_timeline(*, user_id, screen_name, since_id, count, max_id, \ + trim_user, exclude_replies, include_rts) + + Returns the 20 most recent statuses posted from the authenticating user + or the user specified. It's also possible to request another user's + timeline via the id parameter. + + :param user_id: |user_id| + :param screen_name: |screen_name| + :param since_id: |since_id| + :param count: |count| + :param max_id: |max_id| + :param trim_user: |trim_user| + :param exclude_replies: |exclude_replies| + :param include_rts: When set to ``false``, the timeline will strip any + native retweets (though they will still count toward both the + maximal length of the timeline and the slice selected by the count + parameter). Note: If you're using the trim_user parameter in + conjunction with include_rts, the retweets will still contain a + full user object. + + :rtype: list of :class:`Status` objects + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/timelines/api-reference/get-statuses-user_timeline """ return self.request( 'GET', 'statuses/user_timeline', endpoint_parameters=( @@ -326,6 +338,17 @@ class API: ), **kwargs ) + @payload('status', list=True) + def statuses_lookup(self, id, **kwargs): + """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-lookup + """ + return self.request( + 'GET', 'statuses/lookup', endpoint_parameters=( + 'id', 'include_entities', 'trim_user', 'map', + 'include_ext_alt_text', 'include_card_uri' + ), id=list_to_csv(id), **kwargs + ) + @pagination(mode='id') @payload('status', list=True) def retweets_of_me(self, **kwargs):