-
-
Notifications
You must be signed in to change notification settings - Fork 493
Expand file tree
/
Copy pathguest.py
More file actions
26 lines (17 loc) · 562 Bytes
/
guest.py
File metadata and controls
26 lines (17 loc) · 562 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import asyncio
from twikit.guest import GuestClient
client = GuestClient()
async def main():
# Activate the client by generating a guest token.
await client.activate()
# Get user by screen name
user = await client.get_user_by_screen_name('elonmusk')
print(user)
# Get user by ID
user = await client.get_user_by_id('44196397')
print(user)
user_tweets = await client.get_user_tweets('44196397')
print(user_tweets)
tweet = await client.get_tweet_by_id('1519480761749016577')
print(tweet)
asyncio.run(main())