-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·32 lines (24 loc) · 828 Bytes
/
main.py
File metadata and controls
executable file
·32 lines (24 loc) · 828 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
27
28
29
30
31
32
import tweepy
import logging
from tokens import *
from stream import MyStream
def create_api():
auth = tweepy.OAuthHandler(
consumer_key=CONSUMER_KEY, consumer_secret=CONSUMER_SECRET,
access_token=ACCESS_TOKEN, access_token_secret=ACCESS_TOKEN_SECRET)
api = tweepy.API(auth, wait_on_rate_limit=True)
try:
api.verify_credentials()
except Exception as e:
exit(e)
stream = MyStream(
consumer_key=CONSUMER_KEY, consumer_secret=CONSUMER_SECRET,
access_token=ACCESS_TOKEN, access_token_secret=ACCESS_TOKEN_SECRET,
api=api)
return api, stream
def main():
logging.basicConfig(filename="EndFTs.log", filemode = 'w', level = logging.INFO)
api, stream = create_api()
stream.filter(track=["@EndFTs"])
if __name__ == "__main__":
main()