[maemo-users] Any python experts?

From: Jonathan Greene atmasphere at atmasphere.net
Date: Mon Mar 26 22:29:30 EEST 2007
I have a script which will let me post to twitter (yeah yeah I am
hooked hard) and am looking to make it more like an app.

I have the load-run statusbar plugin running so I can invoke the
script,but have to type in quite a bit each time rather than just
entering my status message.

You invoke with a python ~/MyDocs/.documents/twitter.py username
password "status message"  I'd like to just have the status message
part for obvious reasons.  Right now I have to enter the full path +
username and password each time...

This is a personal quest at the moment, but I would imagine more
people would be psyched to have something like this...

Here's the full script which I found here -


# Twitter API
# Copyright (C) 2007 Matthew M. Boedicker <matthewm at boedicker.org>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
# USA.

import sys
import urllib
import urllib2

def twitter_update(user, password, status):
    a = urllib2.HTTPBasicAuthHandler()
    a.add_password("Twitter API",
                   user, password)
    o = urllib2.build_opener(a)

    params = urllib.urlencode({
        "status" : status,

    print o.open("http://twitter.com/statuses/update.xml", params).read()

if len(sys.argv) == 4:
    twitter_update(sys.argv[1], sys.argv[2], sys.argv[3])
    print 'usage: %s username password "status"' % sys.argv[0]

Jonathan Greene
m 917.560.3000
AIM / iChat - atmasphere
gtalk / jabber - jonathangreene at gmail.com
Gizmo - JonathanGreene
blogs - http://www.atmasphere.net/wp  / http://www.maemoapps.com

More information about the maemo-users mailing list