Python Twitter API v1

Ok so this is a first on many levels; my first blog post for this site as well as my first project, app, library (call it what you will) that I am releasing into the ether. As the Twitter phenomenon has very quickly gathered speed, more and more people are trying to access its features; whether its pulling in your latest tweets into your webpage or tweeting directly from your desktop! One of the issues which some people are finding is that quite often if their website is hosted by a company, they may not have permission to install libraries, plugins etc for use in their website.

In order to save face, I thought I had better start pulling my Tweets into this site. So I went to download the Python APIs that other developers have written, but they required me to install the packages before I could use them. This is when I thought ""well, what if we don't have install permissions?"".

So, to combat this I've started writing a Python package that will allow users to (eventually) access all the available Twitter features, regardless of permissons. So all you need to do is put it in your project directory, and use it!

Example

from grailTwitter import Twitter
username = "username"
count = "3"

twit = Twitter(username,count)
twit.getTweets()

for tweet in twit.tweets:
    print tweet.text
    print tweet.date + "\n"

Output

new site is slowly coming together. Just wish I was a little more articulate
about 4 days ago

@searbe steady mate, theres been a few court cases re: Company name 
deformation!
about 5 days ago

Has given in to the twitter beast, with a little help from Fleur. Just a 
shame Macbooks aren't built with Cocker Spaniels in mind
about 8 days ago

Obviously you can look at the code to find out the methods, but below are a few examples of display options
twit.date → about 2 hours ago

twit.link → http://twitter.com/<username>/statuses/<status_id>

twit.fulllink → <a href="http://twitter.com/<username>/statuses/<status_id>"
target="_blank">about 8 days ago</a>

Download the latest version

Comments

 

There are no comments on this page. Be the first to make one!