UPDATE: Twitter has disabled Basic Authentication, which this method uses – so it will no longer work, and you’ll need something a little more sophisticated.
If you’d like to programatically tweet with Python, there are a few established ways to do it. They are both, however, pretty heavy in what they do and require – using either of them, you can do pretty much anything there is to do on Twitter.
This extensive functionality, however, isn’t always needed. Sometimes you only need a bit of functionality – in the case of a project I’m working on, all I need is to be able to send tweets. No getting my list of followers, no blocking user, only sending tweets. From that point of view, both libraries linked earlier are overkill. So I wrote something simple that does just that, as inspired by this post at High Scalability.