-
Notifications
You must be signed in to change notification settings - Fork 2
/
view_tweet_and_more.py
37 lines (26 loc) · 1.07 KB
/
view_tweet_and_more.py
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
27
28
29
30
31
32
33
34
35
36
37
import tweepy
import time
import sys
# NOTE: I put my keys in the credentials.py to separate them
# from this main file.
# Please refer to credentials.py to see the format.
from credentials import twitter_bot_keys
# NOTE: flush=True is just for running this script
print('\nThis is my twitter bot: BerryNews Bot - BNB.\nStarted running...', flush=True)
auth = tweepy.OAuthHandler(twitter_bot_keys['API Key'], twitter_bot_keys['API Key Secret'])
auth.set_access_token(twitter_bot_keys['Access Token'], twitter_bot_keys['Access Token Secret'])
api = tweepy.API(auth)
try:
api.verify_credentials()
print("Authentication OK\n")
except:
print("Error during authentication\n")
tweet = api.get_status(id = 1473313037411094545, trim_user = False, include_ext_alt_text=False, include_card_uri=False )
print('### Printing tweet:\n')
print("Text:", tweet.text)
print("Source:", tweet.source)
print('User name:', tweet.user.name)
print("User screen name:", tweet.user.screen_name)
print("User followers:", tweet.user.followers_count)
print()
print('BNB finished running...\n', flush=True)