Wednesday, January 20, 2016

Experimenting with the twitter API client birdy

I stumbled upon the twitter API client birdy whose description reads a super awesome Twitter API client for Python.

Of course, inquiring minds want to know, so I wrote a little script ( The script takes one argument: the name of a twitter account. In the following screenshot, I read some account data for the account twitterapi:

For example, the script reports that twitterapi has 5.3 million followers, but follows only 48 other accounts.

The script is also able to read the current status. For a reason I don't understand, the status for twitterapi seems always to be "@TheNiceBot aww thanks, you're lovely too! :-)". The status is correct, however, for other accounts.

Here's the script

import os import sys from birdy.twitter import UserClient if len(sys.argv) < 2: print "specify screen name" sys.exit() screen_name = sys.argv[1] tw = UserClient(os.environ['TWITTER_CONSUMER_KEY' ], os.environ['TWITTER_CONSUMER_SECRET' ], os.environ['TWITTER_ACCESS_TOKEN' ], os.environ['TWITTER_ACCESS_TOKEN_SECRET']) r =['profile_background_image_url_https'] # for key, value in : # print key status_id=str(['status']['id_str']) print "" print "Current Status" print " of " +['status']['created_at'] print " url=" + screen_name + "/status/" + status_id print "------------------------------------------------------" print['status']['text'] print "--------------" print "" print "Name: " +['name' ] print "Description: " +['description' ] print "Followers: " + str(['followers_count']) print "Following: " + str(['friends_count' ]) print "Tweets: " + str(['statuses_count' ]) print "Language: " +['lang' ]
account_info on github.
Inueni's github repository birdy.


  1. Nice write-up, thanks René!

    That's actually the correct most recent Tweet from the @twitterapi account (you'll have to switch to the Tweets & Replies tab on the user profile page to see that on the web site). It is generally a low-volume account used for API announcements.

    birdy is a nice library for Python, there is also tweepy which is pretty popular as well.

    Thanks for sharing with the community!

    1. Thanks a lot for your feedback, Andy. I definitely should take a look at tweepy another day.