Скопировал код для ретвиттов на новую модульную систему

This commit is contained in:
2017-05-16 15:02:58 +03:00
parent 565fced8ba
commit 92fa8e21b5
9 changed files with 128 additions and 79 deletions

17
retweet.py Normal file
View File

@@ -0,0 +1,17 @@
from twython import Twython, TwythonError
import authorization
def retweet(): #retweet tweets with a set hashtag
search_results = authorization.twitter.search(q="#TwitterShitter", count=5)
try:
for tweet in search_results["statuses"]:
authorization.twitter.retweet(id = tweet["id_str"])
log_str = "retweeted "+tweet["id_str"]
log_file=open('log_file.txt', 'a')
log_file.write(log_str)
log_file.close()
print log_str,
except TwythonError as e:
print e
return