Upgraded to python3
This commit is contained in:
parent
e3fb71b68f
commit
d95260d97e
4
main.py
4
main.py
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import tweepy
|
||||
|
@ -20,5 +20,5 @@ if __name__ == '__main__':
|
|||
while True:
|
||||
stream = tweepy.Stream(auth = api.auth, listener=RetweetingStreamListener(api))
|
||||
stream.filter(track=['#zaunei2016', '@zaunei2016'])
|
||||
print "[Error] Something went wrong reconnecting"
|
||||
print("[Error] Something went wrong reconnecting")
|
||||
sleep(10.0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import tweepy
|
||||
|
@ -8,21 +8,21 @@ class RetweetingStreamListener(tweepy.StreamListener):
|
|||
|
||||
|
||||
def on_status(self, status):
|
||||
print "[Info] %s - %s" % (status.user.screen_name, status.text)
|
||||
print("[Info] %s - %s" % (status.user.screen_name, status.text))
|
||||
|
||||
if not hasattr(status, 'retweeted_status'):
|
||||
status.retweet()
|
||||
print "[Info] Retweeted!"
|
||||
print("[Info] Retweeted!")
|
||||
|
||||
|
||||
print "-----------------------------------------"
|
||||
print("-----------------------------------------")
|
||||
|
||||
|
||||
def on_error(self, status_code):
|
||||
# Rate limiting
|
||||
if status_code == 420:
|
||||
print "[Error] Got Error 420, rate limiting in effect"
|
||||
print("[Error] Got Error 420, rate limiting in effect")
|
||||
#returning False in on_data disconnects the stream
|
||||
return False
|
||||
|
||||
print "[Error] Got status code %d" % status_code
|
||||
print("[Error] Got status code %d" % status_code)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue