|
|
@ -4,7 +4,12 @@ import tweepy
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
|
|
|
parser.add_argument("--filename", type=str)
|
|
|
|
|
|
|
|
parser.add_argument("--prompt", type=str)
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
load_dotenv()
|
|
|
|
load_dotenv()
|
|
|
|
|
|
|
|
|
|
|
|
# Authenticate to Twitter
|
|
|
|
# Authenticate to Twitter
|
|
|
@ -15,8 +20,8 @@ auth.set_access_token(os.getenv("TOKEN"), os.getenv("TOKENSECRET"))
|
|
|
|
api = tweepy.API(auth)
|
|
|
|
api = tweepy.API(auth)
|
|
|
|
|
|
|
|
|
|
|
|
# Create a tweet
|
|
|
|
# Create a tweet
|
|
|
|
media = api.media_upload(sys.argv[1])
|
|
|
|
media = api.media_upload(args.filename)
|
|
|
|
|
|
|
|
alt_text = api.create_media_metadata(media.media_id, args.prompt)
|
|
|
|
tweet = ""
|
|
|
|
tweet = ""
|
|
|
|
api.update_status(status=tweet, media_ids=[media.media_id])
|
|
|
|
api.update_status(status=tweet, media_ids=[media.media_id])
|
|
|
|
|
|
|
|
|
|
|
|