Skip to content

Instantly share code, notes, and snippets.

@pmnlla
Last active November 14, 2019 17:13
Show Gist options
  • Save pmnlla/f977d364ff08ce01ed78f15c214649b0 to your computer and use it in GitHub Desktop.
Save pmnlla/f977d364ff08ce01ed78f15c214649b0 to your computer and use it in GitHub Desktop.
tweet_from_fridge with replies (Python)
import sys, os, time
import tweepy
#Credit to KonradIT on GithubGist for making the original script, tweet_from_fridge.py
#I had only modified it so it can reply to tweets, nothing else.
#All credit goes to the original author.
keys = dict(
consumer_key='put',
consumer_secret='your',
access_token='tokens',
access_token_secret='here'
)
ReplyMode = input("Reply? (respond with 'y' or 'n'): ")
user = "@<username>"
auth = tweepy.OAuthHandler(keys['consumer_key'], keys['consumer_secret'])
auth.set_access_token(keys['access_token'], keys['access_token_secret'])
api = tweepy.API(auth)
if ReplyMode == "y":
def tweet():
TweetID = input("Reply to: ")
message = input("tweet: ")
api.update_status(message, in_reply_to_status_id=TweetID, auto_populate_reply_metadata=True)
sys.exit()
else:
def tweet():
message = input("tweet: ")
api.update_status(message)
sys.exit()
if __name__ == "__main__":
while 1:
tweet()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment