Skip to content

Instantly share code, notes, and snippets.

@ssrlive
Created December 5, 2021 02:41
Show Gist options
  • Save ssrlive/6c163b99c53c3f4bb5534fc0d8627954 to your computer and use it in GitHub Desktop.
Save ssrlive/6c163b99c53c3f4bb5534fc0d8627954 to your computer and use it in GitHub Desktop.
Tweet with images
import tweepy
consumer_key = u""
consumer_secret = u""
access_token = u""
access_token_secret = u""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
#api.update_status("This Tweet was Tweeted using Tweepy!")
upload_result = api.media_upload('/home/ubuntu/a.jpg')
api.update_status(status="test tweet again", media_ids=[upload_result.media_id_string])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment