Skip to content

Commit 3ac0c7c

Browse files
authored
Merge pull request #105 from MerleLiuKun/feat-pagination-tweet
feat(parameter): ✨ Add parameters for pagination for tweet's…
2 parents 6cbeec5 + fabbe85 commit 3ac0c7c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pytwitter/api.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,8 @@ def get_tweet_retweeted_users(
924924
self,
925925
tweet_id: str,
926926
*,
927+
pagination_token: Optional[str] = None,
928+
max_results: Optional[int] = None,
927929
user_fields: Optional[Union[str, List, Tuple]] = None,
928930
expansions: Optional[Union[str, List, Tuple]] = None,
929931
tweet_fields: Optional[Union[str, List, Tuple]] = None,
@@ -933,6 +935,9 @@ def get_tweet_retweeted_users(
933935
Get information about who has Retweeted a Tweet.
934936
935937
:param tweet_id: The tweet ID whose retweeted users you would like to retrieve.
938+
:param pagination_token: Token for the pagination.
939+
:param max_results: The maximum number of results to be returned per page. Number between 1 and the 100.
940+
By default, each page will return 100 results.
936941
:param user_fields: Fields for the user object.
937942
:param expansions: Fields for the expansions now only `pinned_tweet_id`.
938943
:param tweet_fields: Fields for the tweet object, Expansions required.
@@ -948,6 +953,8 @@ def get_tweet_retweeted_users(
948953
"tweet.fields": enf_comma_separated(
949954
name="tweet_fields", value=tweet_fields
950955
),
956+
"max_results": max_results,
957+
"pagination_token": pagination_token,
951958
}
952959
return self._get(
953960
url=f"{self.BASE_URL_V2}/tweets/{tweet_id}/retweeted_by",
@@ -994,6 +1001,8 @@ def get_tweet_liking_users(
9941001
self,
9951002
tweet_id: str,
9961003
*,
1004+
pagination_token: Optional[str] = None,
1005+
max_results: Optional[int] = None,
9971006
user_fields: Optional[Union[str, List, Tuple]] = None,
9981007
expansions: Optional[Union[str, List, Tuple]] = None,
9991008
tweet_fields: Optional[Union[str, List, Tuple]] = None,
@@ -1003,6 +1012,9 @@ def get_tweet_liking_users(
10031012
Get information about a Tweet’s liking users.
10041013
10051014
:param tweet_id: The tweet ID whose liking users you would like to retrieve.
1015+
:param pagination_token: Token for the pagination.
1016+
:param max_results: The maximum number of results to be returned per page. Number between 1 and the 100.
1017+
By default, each page will return 100 results.
10061018
:param expansions: Fields for the expansions.
10071019
By default, each page will return 100 results.
10081020
:param tweet_fields: Fields for the tweet object.
@@ -1019,6 +1031,8 @@ def get_tweet_liking_users(
10191031
"tweet.fields": enf_comma_separated(
10201032
name="tweet_fields", value=tweet_fields
10211033
),
1034+
"max_results": max_results,
1035+
"pagination_token": pagination_token,
10221036
}
10231037
return self._get(
10241038
url=f"{self.BASE_URL_V2}/tweets/{tweet_id}/liking_users",

0 commit comments

Comments
 (0)