• Zeth will be attending PyCon UK on the 12th to 14th September 2008.

Using new social networking service Identi.ca from the command line

23 July 2008

Social networking is fickle

Over a year ago, I talked about how I joined Facebook and Mugshot, then as part of my ten crazy New Year predictions, I argued that social networking will eventually become a protocol. Social networking is fickle, as people move on to the next pub.

After Easter, I joined Twitter and I wrote a post about Scripting Twitter with Python, and how I tried to integrate Twitter into my GNOME desktop.

One of the problems I had with Twitter was the API was heavily rate limited, so I would get suspended from the API often when trying to experiment with spidering the social network (e.g. give me all the friends of friends who have mentioned fishing).

A new Identi

The new kid on the block is Identi.ca. Like Twitter, on Identi.ca, you post your latest status update of up to 140 characters, and you can subscribe to other people's updates.

So here is my page on Identi.ca:

http://media.commandline.org.uk/images/posts/other/identica.png

Identi.ca is brand new, so not as many people are using it yet as Twitter. As you can see, currently I only have three 'friends' on Identi.ca. If you have a go, do become my virtual friend!

A few differences from Twitter are that Identi.ca's source code is published online (under the name Laconica) and you can use OpenID to login if you want. Also the API is not rate limited and Identi.ca does not currently have the rate problems that Twitter has (Twitter is offline with capacity problems all the time these days).

Identi.ca plan API breakage but that:

'The documented write API below will remain available until at least September 30, 2008' . Source

I wrote my own quick tool for Identi. I was quite impressed how far I got with it in just an hour, my code output in Python is increasing nicely ;-)

It is a command line tool for getting and sending your updates to Identi.ca.

It is less advanced than my Twitter module because the API will change. It doesn't cache anything for example.

To use my tool, you need feedparser on your system. On Ubuntu:

sudo apt-get install python-feedparser

On Gentoo:

sudo emerge feedparser

If you are another platform (e.g. Mac or Windows) and you have Python's Setup tools installed you can go:

easy_install feedparser

Now you need to get my tool. You can download it from my code page, and save it as identi.py. If you have made a script directory then just throw the file in and then call the program with identi.py. Otherwise you can run it with the python command:

python identi.py

This will download the updates from all the friends that you are following. If you have a lot of updates, then you can limit it. The following command will download the latest 10 updates:

python identi.py -n 10

For complete options, run with -h:

python identi.py -h

so we have downloaded messages. Next is uploading a message, for that just write it at the command line:

python identi.py Just saw a great post at http://commandline.org.uk

The Bash shell does not allow unmatched quotes. My program does not care but if you have unmatched quotes then your message won't even get to my program. So if you want to use unmatched quotes then surround the whole thing with single or double quote marks, for example:

python identi.py "Just saw a great post at Zeth's blog http://commandline.org.uk"

Your username and password are asked for when needed. If this gets on your nerves, you can edit the top of identi.py and provide them.

If you know Python you could also use it as a Python binding:

import identi
myid = identi.IdentiCA(username = "zeth", password = "something")
myid.login()
messages = myid.get_messages()
new_message = 'Posting direct from my Python Shell'
myid.put_message(new_message)

That is really about all it does, if you need something more then you may be better off reading the API documentation.

What do you have to say?

Show Editing Help


PyCon UK

About

Hello, my name is Zeth, I'll be your host here.

Command Line Warriors is about taking control of your own technology, it looks at our experiences of computing; especially using GNU/Linux, the Python programming language, the command-line and issues such as techno-ethics, best practices and whatever is cool now. If you take control of your technology then you are a Warrior too!

This site is your site too which means that you can contribute and get involved. You can leave comments using the facility provided. For me, the comments and discussions are by far the best part of the site. So please do have your say!

Latest Discussions

Naib

August 27, 2008
And the greatest flaw with this "simple" talley? Women's eights final: 1 United States 6:05.34 Gold 2 Netherlands 6:07.22 Silver 3 Romania 6:07.25 Bronze Men's quadruple sculls final: 1 Poland ...
An Alternative Olympic Medal Table

james

August 27, 2008
Great discussion and a great "add-on" with the European countries! I still find medals per Capita very interesting because it indicates how many medals a country has won, from the ...
An Alternative Olympic Medal Table

Steve

August 27, 2008
Flawed logic. This comparison would only make sense if the EU could only send the same amount of competitors as a single country. Since it is treated as many small ...
An Alternative Olympic Medal Table

Zeth

August 27, 2008
Hi Benjamin, as far as I know, you can put any GSM SIM card into your OpenMoko, so you have the freedom to choose the best deal for you from ...
OpenMoko vs iPhone - Free your phone or Fight your phone?

Benjamin Melançon

August 25, 2008
Network question. I know more about computers than cell phones. Can anyone tell me or point me to a resource about what purchase options for network access are. For instance ...
OpenMoko vs iPhone - Free your phone or Fight your phone?

Mark (Cycom on freenode)

August 23, 2008
Two separate ideas here: First: Is not the competition between KDE and GNOME a good thing? It drives both to improve in a way that Mac and Windows and Linux ...
Is GUADEC just GDEC?

Zeth

August 21, 2008
Thanks for your comments guys, the newspapers need to sit a while on the naughty step until they are willing to play nicely. John Reese, thanks for visiting, it is ...
Newspapers please link to your sources

John

August 20, 2008
Zeth, The link to this file (for view wireless history) doesn't bring up a dialogue. Could you fix this?
Five Tips for Easter

John Reese

August 20, 2008
They're *carts*, not "trolleys"! ;)
Newspapers please link to your sources

akahn

August 20, 2008
Control-L usually selects the whole address, so only Control-L Control-C would be needed.
Newspapers please link to your sources

Sean

August 20, 2008
That was good. I'm crackin' up.
Newspapers please link to your sources

Garrick

August 20, 2008
Here here!
Newspapers please link to your sources

Seth Kriticos

August 19, 2008
bkil: "GTK and Gecko-tied extensions could be ported to non-gecko browsers." *cough* Epiphany is running on gecko currently and integrates some extensions thereof, they are just planning to switch to ...
Will Epiphany be able to compete with Firefox's extensions?

Harshad Modi

August 18, 2008
Thanks helping me!!! but I have problem on banner.... I try to make my own sftp server using paramiko inherit paramiko.ServerInterface class. but I got this error: ERROR:paramiko.transport:SSHException: Error reading ...
SFTP in Python: Paramiko