-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzibi_tweets.py
33 lines (25 loc) · 927 Bytes
/
zibi_tweets.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
import sys, tweepy
import private
#authenthication function
def twitter_auth():
try:
consumer_key = private.consumer_key
consumer_secret_key = private.consumer_secret_key
access_token = private.access_token
access_secret_token = private.access_secret_token
except KeyError:
sys.stderr.write('Brak zmiennej środowiskowej TWITTER_*\n')
sys.exit(1)
auth = tweepy.OAuthHandler(consumer_key, consumer_secret_key)
auth.set_access_token(access_token, access_secret_token)
return auth
def get_twitter_client():
auth = twitter_auth()
client = tweepy.API(auth, wait_on_rate_limit=True)
return client
#Konto Zbigniewa Bońka: 'BoniekZibi'
if __name__ == '__main__':
user = input('Podaj użytkownika: ')
client = get_twitter_client()
for status in tweepy.Cursor(client.user_timeline, screen_name=user).items():
print(status.text)