Created
March 9, 2019 21:24
-
-
Save mainframed/70b43168ff94ba70448e8d9161a1020f 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
#!/usr/bin/env python | |
import tweepy | |
import sys | |
# argument 1 is the tweet, argument 2 is the path to the image | |
def get_api(cfg): | |
auth = tweepy.OAuthHandler(cfg['consumer_key'], cfg['consumer_secret']) | |
auth.set_access_token(cfg['access_token'], cfg['access_token_secret']) | |
return tweepy.API(auth) | |
def main(): | |
cfg = { | |
"consumer_key" : "", | |
"consumer_secret" : "", | |
"access_token" : "", | |
"access_token_secret" : "" | |
} | |
api = get_api(cfg) | |
tweet = sys.argv[1] | |
#status = api.update_status(status=tweet) | |
imagePath = sys.argv[2] | |
status = api.update_with_media(imagePath, tweet) | |
#print status | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment