Skip to content

Commit

Permalink
error fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
hmangukia committed Jul 16, 2018
1 parent 996e053 commit aac787e
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions windows/benji.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,28 @@ def events(frame,put):
cv2.imwrite(path + "/" + str(name) + ".jpg", img)
cam.release()
cv2.destroyAllWindows()


#Get top 10 tweets
elif link[0] == "get" and link[-1] == "tweets":
auth = OAuthHandler(twitterCredentials.consumer_key, twitterCredentials.consumer_secret)
auth.set_access_token(twitterCredentials.access_token, twitterCredentials.access_secret)
api = tweepy.API(auth)
if link[-2] == "my":
for tweet in tweepy.Cursor(api.user_timeline).items(10):
print("\n", json.dumps(tweet.text))
print("on ", tweet.created_at)
elif link[1] == "tweets":
for status in tweepy.Cursor(api.home_timeline).items(10):
print("\n", status.text)
print("By ", status.user.screen_name, " at ", status.user.created_at)

#Get friends from twitter
elif link[-1] == "twitter" and link[-3] == "follow":
auth = OAuthHandler(twitterCredentials.consumer_key, twitterCredentials.consumer_secret)
auth.set_access_token(twitterCredentials.access_token, twitterCredentials.access_secret)
api = tweepy.API(auth)
for friend in tweepy.Cursor(api.friends).items():
print("\nName: ", json.dumps(friend.name), " Username: ", json.dumps(friend.screen_name))
#Screenshot
elif put.startswith('take screenshot') or put.startswith("screenshot"):
try:
Expand Down Expand Up @@ -714,28 +735,6 @@ def main():
#Exit/Quit
elif put.startswith('exit') or put.startswith('quit'):
sys.exit()

#Get top 10 tweets
elif link[0] == "get" and link[-1] == "tweets":
auth = OAuthHandler(twitterCredentials.consumer_key, twitterCredentials.consumer_secret)
auth.set_access_token(twitterCredentials.access_token, twitterCredentials.access_secret)
api = tweepy.API(auth)
if link[-2] == "my":
for tweet in tweepy.Cursor(api.user_timeline).items(10):
print("\n", json.dumps(tweet.text))
print("on ", tweet.created_at)
elif link[1] == "tweets":
for status in tweepy.Cursor(api.home_timeline).items(10):
print("\n", status.text)
print("By ", status.user.screen_name, " at ", status.user.created_at)

#Get friends from twitter
elif link[-3] == "follow" and link[-1] == "twitter":
auth = OAuthHandler(twitterCredentials.consumer_key, twitterCredentials.consumer_secret)
auth.set_access_token(twitterCredentials.access_token, twitterCredentials.access_secret)
api = tweepy.API(auth)
for friend in tweepy.Cursor(api.friends).items():
print("\nName: ", json.dumps(friend.name), " Username: ", json.dumps(friend.screen_name))

#A stdout class to redirect output to tkinter window
class StdRedirector(object):
Expand Down

0 comments on commit aac787e

Please sign in to comment.