Back to photostream

2007JAN142332

Been hacking away at the twitter api. have a pice of code that grabs my current friends & my own postings via the twitter api. It's currently using the ' list of your friends and their current update' (http://twitter.com/statuses/friends.xml) call.

 

The code uses the python httplib to extract the file, and the xml.dom.minidom api to parse the file. The format for the returned xml is something like this ...

 

*status*

created_at

id

text

relative_created_at

*user*

id

name

screen_name

location

description

profile_image_url

url

 

Why they decided to whack the 'user' details in a lower node level I do not know. Finally got it to work by

 

 

* extracting the xml file

* parsing the xml file

* stuffing the values into a list of dictionaries

* looping through the list & extracting the values

 

I could have saved myself all the drama by using the RSS file. But the adantage is I can get the instantaeous state of twitter at any time & process it at my will.

 

Here we see the python program being called on the commandline. I can redirect the results to a file then cat them.

 

next >>>

1,020 views
0 faves
1 comment
Uploaded on January 14, 2007
Taken on January 14, 2007