#!/usr/bin/env pythonimportsysimportjsonimportosimporttweetponyimportargparse"""
Function to post image to twitter with accompanying tweeet.
Go to twitters developers page and get credentials:
consumer_key
consumer_secret
access_token
access_token_secret
Enter credentials in line 37
Usage: $ tweetup -f /path/to/image/file -t "Tweet text"
"""# create proper command args for image file (-f) and tweet(-t)defmain(args):parser=argparse.ArgumentParser()parser.add_argument("-f","--file",dest="file")parser.add_argument("-t","--tweet",dest="tweet")# parse the argsargs=parser.parse_args()# magic function for authorizing twitter API and accountapi=tweetpony.API('consumer_key','consumer_secret','access_token','access_token_secret')# function for sending the image and tweetstatus=api.update_status_with_media(status=args.tweet,media=args.file)if__name__=="__main__":main(sys.argv)