Monday, July 26, 2010

Updates: The Middleman and Talk Like Warren are now secure-ish!

To bring @FakeMiddleman and @TalkLikeWarren in line with upcoming Twitter API Changes that will disable basic auth support and require people use OAuth to authenticate to the API.

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:

  1. Go to and fill in the form
  2. Choose 'Client', 'Read & Write' and 'Yes, use Twitter for login'
  3. Take note of the Consumer key and Consumer secret
  4. easy_install tweepy
  5. wget
  6. python
  7. Take note of the Key and Secret value
Now here's a helloworld OAuth app with tweepy:

import tweepy
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(TOKEN_KEY, TOKEN_SECRET)
api = tweepy.API(auth)
api.update_status("I CAN HAZ OAUTH")

The new Twitter dev site is cool 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

No comments:

Post a Comment