Last active
December 30, 2015 16:49
-
-
Save hideshi/7857171 to your computer and use it in GitHub Desktop.
How to post message to your twitter account through twitter api.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twitter import Twitter, OAuth, TwitterHTTPError | |
# If you have twitter account, | |
# Register your app on https://dev.twitter.com so that you can get these information. | |
OAUTH_TOKEN = 'xxxx' | |
OAUTH_SECRET = 'xxxx' | |
CONSUMER_KEY = 'xxxx' | |
CONSUMER_SECRET = 'xxxx' | |
api = Twitter(auth = OAuth(OAUTH_TOKEN, OAUTH_SECRET, CONSUMER_KEY, CONSUMER_SECRET)) | |
try: | |
api.statuses.update(status = 'Post message') | |
except TwitterHTTPError as e: | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment