Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Copenhacks2018PythonTwitterAPI
import tweepy
consumer_key = "0D1k9X4rvKeNjJMU6AjyOYfv2"
consumer_secret = "L2sPX4appghs9F4afaT1ISNyHxWgGJAXSoEumzJOQS6IjvltCF"
access_token = "434339373-8DKIoTsy5K2OfH8DYdvofQUtAILjZ6ZFQWj4DwJc"
access_token_secret = "MbNois2Rfcmtv2EvHb31jjIqm5cHV5oUZQHA5pRJrw6MX"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
#public_tweets = api.home_timeline()
#for tweet in public_tweets:
# print(tweet.text)
sendText = "Dog person"
re = api.send_direct_message("zochats",text = sendText)
message = []
try:
message = api.get_direct_message("zochats",True)
except tweepy.error.TweepError:
pass
# get bot response and send more
print (message);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.