File: get_users_mentions.py

package info (click to toggle)
tweepy 4.12.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,488 kB
  • sloc: python: 6,042; makefile: 16; javascript: 10
file content (24 lines) | stat: -rw-r--r-- 592 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import tweepy


bearer_token = ""

client = tweepy.Client(bearer_token)

# Get User's Mentions

# This endpoint/method returns Tweets mentioning a single user specified by the
# requested user ID

user_id = 2244994945

response = client.get_users_mentions(user_id)

# By default, only the ID and text fields of each Tweet will be returned
for tweet in response.data:
    print(tweet.id)
    print(tweet.text)

# By default, the 10 most recent Tweets will be returned
# You can retrieve up to 100 Tweets by specifying max_results
response = client.get_users_mentions(user_id, max_results=100)