-
Notifications
You must be signed in to change notification settings - Fork 0
Tweet from LinkIt Smart Duo
Alex Simon edited this page Feb 7, 2016
·
2 revisions
- Visit: https://apps.twitter.com/
- Go to
Keys and Access Tokens
- Copy the Consumer Key and Secret
- Create a new token, and copy the Access Token Key and Secret
NOTE: make sure the app has Read and Write
permission
pip install python-twitter
import twitter
# Twitter variables
twitterCK = '***' # Consumer Key
twitterCS = '***' # Consumer Secret
twitterATK = '***' # Access Token Key
twitterATS = '***' # Access Token Secret
def tweet():
api = twitter.Api(consumer_key=twitterCK,
consumer_secret=twitterCS,
access_token_key=twitterATK,
access_token_secret=twitterATS)
try:
message = 'My tweet'
status = api.PostUpdate(message)
except twitter.TwitterError:
print "Error in posting twitter Update"
print status