Unfortunately the version of Mike Verdone's Twitter Tools I have doesn't support OAuth so I ended up switching to Tweepy which is a bit more heavy duty. Along with OAuth support Tweepy supports the Twitter Streaming API which allows you to get real time timeline updates. OAuth is more complicated than Basic Auth but is way more secure. Twitter has provided a nice document explaining the basic concepts behind OAuth and how to transition away from Basic Auth.
Let me segue and present the 30 second Tweepy and OAuth tutorial:
- Go to http://twitter.com/apps and fill in the form
- Choose 'Client', 'Read & Write' and 'Yes, use Twitter for login'
- Take note of the Consumer key and Consumer secret
- easy_install tweepy
- wget https://raw.github.com/tweepy/examples/master/oauth/getaccesstoken.py
- python getaccesstoken.py
- Take note of the Key and Secret value
Now here's a helloworld OAuth app with tweepy:
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
api = tweepy.API(auth)
api.update_status("I CAN HAZ OAUTH")
The new Twitter dev site is cool http://dev.twitter.com it has various bits and pieces including Twitter API Status which gives you the status of various API calls, their performance and uptime as well as service announcements. Even cooler is the Twitter API Console which is a nice simple place to give the Twitter API a test drive.
For those interested here is the updated code for @FakeMiddleman and @TalkLikeWarren
Post a Comment