First you need to install python-twitter
pip3 install python-twitter
api = twitter.Api(consumer_key="YOUR_CONSUMER_KEY", consumer_secret="YOUR_CONSUMER_SECRET", access_token_key="ACCESS-TOKEN-KEY", access_token_secret="ACCESS-TOKEN-SECRET")
file = open(some-local-image-path, "rb") status = api.PostUpdate("This is a tweet with a picture. Via Python!", media=file)
My name is Omar Qunsul. I write these articles mainly as a future reference for me. So I dedicate some time to make them look shiny, and share them with the public.
And btw, if you like playing chess, please give my personal multiplayer Chess Website ChessDuo a try.