There is a far simpler way to update your post as opposed to the way Twython
actually shows you. It will take more work on your API console space though, so let me begin.
Firstly, you will need to go to your apps page. After you've selected the application that you are using right now, take a look at the page you are given. You should be at the Details tab by default.
Now that you are where you're supposed to be, click on the Settings tab right next to the Details tab as shown above.
After that, scroll down until you see this:
Click the option as shown above. Now after you've selected the option scroll down until you see a blue button saying Update this twitter's application settings.
Now, head back over to your Details tab. Go to the bottom and generate your required tokens, please note that you might have to click the buttons a couple of times to get it to work (also, make sure that your access level is Read, write, and direct messages when the token is generated):
- Now you have everything necessary for connecting and posting to your twitter account. You have the
Consumer key
and theConsumer Secret
, theAccess token
and theAccess token secret
. You have everything that you need.
Okay, now head over to your code editor, and write the following boiler-plate code (these keys wont work, I just got rid of the application, so no hacking here :P I've given them simply as an indication of the length of the keys that you should expect):
from twython import Twython
APP_KEY = '' # Customer Key here
APP_SECRET = '' # Customer secret here
OAUTH_TOKEN = '1936951807-z5bBNING8P1TU2onWvJh5dh8hoYlYAmNOaAx2OX' # Access Token here
OAUTH_TOKEN_SECRET = 'QWJEZ7ridSeZGdxJELSBk7mupCpMA9q9sLCou5ywg' # Access Token Secret here
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
twitter.update_status(status="Hello from Python! :D")
After this, check your twitter, you should see a new tweet saying "Hello from Python! :D".