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 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import tweepy
|
import tweepy
|
||||||
|
@ -20,5 +20,5 @@ if __name__ == '__main__':
|
||||||
while True:
|
while True:
|
||||||
stream = tweepy.Stream(auth = api.auth, listener=RetweetingStreamListener(api))
|
stream = tweepy.Stream(auth = api.auth, listener=RetweetingStreamListener(api))
|
||||||
stream.filter(track=['#zaunei2016', '@zaunei2016'])
|
stream.filter(track=['#zaunei2016', '@zaunei2016'])
|
||||||
print "[Error] Something went wrong reconnecting"
|
print("[Error] Something went wrong reconnecting")
|
||||||
sleep(10.0)
|
sleep(10.0)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import tweepy
|
import tweepy
|
||||||
|
@ -8,21 +8,21 @@ class RetweetingStreamListener(tweepy.StreamListener):
|
||||||
|
|
||||||
|
|
||||||
def on_status(self, status):
|
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'):
|
if not hasattr(status, 'retweeted_status'):
|
||||||
status.retweet()
|
status.retweet()
|
||||||
print "[Info] Retweeted!"
|
print("[Info] Retweeted!")
|
||||||
|
|
||||||
|
|
||||||
print "-----------------------------------------"
|
print("-----------------------------------------")
|
||||||
|
|
||||||
|
|
||||||
def on_error(self, status_code):
|
def on_error(self, status_code):
|
||||||
# Rate limiting
|
# Rate limiting
|
||||||
if status_code == 420:
|
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
|
#returning False in on_data disconnects the stream
|
||||||
return False
|
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 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue