File: get_users.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 (21 lines) | stat: -rw-r--r-- 555 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
import tweepy


bearer_token = ""

client = tweepy.Client(bearer_token)

# Get Users

# This endpoint/method returns a variety of information about one or more users
# specified by the requested IDs or usernames

user_ids = [2244994945, 6253282]

# By default, only the ID, name, and username fields of each user will be
# returned
# Additional fields can be retrieved using the user_fields parameter
response = client.get_users(ids=user_ids, user_fields=["profile_image_url"])

for user in response.data:
    print(user.username, user.profile_image_url)