Last active
December 8, 2017 13:49
-
-
Save BlogBlocks/4a14d9dff41ac546185c5909b407f3a3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # post image and tweet to Twitter | |
| # USAGE: import Tpost | |
| # Tpost.tpost(ImgPath,STR) | |
| import sys | |
| import twython | |
| from twython import Twython | |
| import Key | |
| def tpost(ImgPath,STR): | |
| CONSUMER_KEY = Key.twiter()[0] | |
| CONSUMER_SECRET = Key.twiter()[1] | |
| ACCESS_KEY = Key.twiter()[2] | |
| ACCESS_SECRET = Key.twiter()[3] | |
| twitter = Twython(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY,ACCESS_SECRET) | |
| photo = open(ImgPath,'rb') | |
| response = twitter.upload_media(media=photo) | |
| twitter.update_status(status=STR, media_ids=[response['media_id']]) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just what it sounds like a short Quick Tweet