Phillip Pearson - Second p0st

tech notes and web hackery from the guy that brought you bzero, python community server, the blogging ecosystem, the new zealand coffee review and the internet topic exchange

2003-10-1

Topic Exchange mailing list (for users)

There is now a mailing list for Topic Exchange users. If you're interested in the client, please sign up. All you need to do is enter your e-mail address in the box on the homepage and click 'Subscribe'. Hope to see you there!
... more like this: []

How do you send blog posts with complicated RSS over the metaWeblog API?

An item in an RSS 2.0 feed looks like this:

<item>
    <title>title</title>
    <link>http://example.com/path/to/post</link>
    <guid>http://example.com/path/to/post</guid>
    <description>an rss2 item looks like this:
 
&lt;item&gt;
&nbsp;&nbsp;&nbsp; &lt;title&gt;title&lt;/title&gt;...</description>
</item>

title, link, guid and description are all part of the spec.  You can put in other things if you like, as long as you put them in a namespace.  Say, if you want to categorise this item under the Topic Exchange's Software channel, you could say that this way:

<item xmlns:ent="http://purl.org/NET/ENT/1.0/">
    <title>title</title>
    <link>http://example.com/path/to/post</link>
    <guid>http://example.com/path/to/post</guid>
    <description>an rss2 item looks like this:
 
&lt;item&gt;
&nbsp;&nbsp;&nbsp; &lt;title&gt;title&lt;/title&gt;...</description>
    <ent:cloud ent:href="http://topicexchange.com/topics">
        <ent:topic ent:id="software" ent:href="http://topicexchange.com/t/software/">software</ent:topic>
    </ent:cloud>
</item>

ent:cloud and ent:topic, as well as the attributes ent:href and ent:id are all defined in the ENT spec.

If you wanted to make this item into a book review, still in the same channel, you could say it like this.

<item xmlns:ent="http://purl.org/NET/ENT/1.0/" xmlns:rvw="http://purl.org/NET/RVW/0.1/">
    <title>title</title>
    <link>http://example.com/path/to/post</link>
    <guid>http://example.com/path/to/post</guid>
    <description>an rss2 item looks like this:
 
&lt;item&gt;
&nbsp;&nbsp;&nbsp; &lt;title&gt;title&lt;/title&gt;...</description>
    <ent:cloud ent:href="http://topicexchange.com/topics">
        <ent:topic ent:id="software" ent:href="http://topicexchange.com/t/software/">software</ent:topic>
    </ent:cloud>
    <rvw:item>
        <rvw:link>http://www.amazon.com/exec/obidos/ASIN/0156027321/</rvw:link>
        <dc:identifier>ASIN:0156027321</dc:identifier>
        <dc:type>Text</dc:type>
        <dc:title>Life of Pi</dc:title>
        <dc:creator>Yann Martel</dc:creator>
        <dc:publisher>Harvest Books</dc:publisher>
        <dc:date>2003-05</dc:date>
        <ent:cloud ent:href="http://www.pmbrowser.info/rvw/">
            <ent:topic ent:href="http://www.pmbrowser.info/rvw/types.xtm#book" ent:id="book">Book</ent:topic>  
        </ent:cloud>
        <rvw:rating>
            <rvw:minimum>0</rvw:minimum>
            <rvw:maximum>10</rvw:maximum>
        <rvw:value>7</rvw:value>
        </rvw:rating>
    </rvw:item>
</item>

All the rvw elements are defined in the RVW spec.

Now, if you want to post something like this to a weblog, what are your options?  Basically, you can use the metaWeblog API or make up your own one.  If you use the existing API, you will be compatible with many existing blogging tools, and if you make up your own one, you won't.

In Python, the call to post a normal blog post looks like this:

import xmlrpclib
s = xmlrpclib.Server('http://127.0.0.1:5335/RPC2')
s.metaWeblog.newPost(BLOGID, LOGIN, PASSWORD, {
    'title': TITLE,
    'link': LINK,
    'description': DESCRIPTION,
})

BLOGID, for Radio, is 'home'.  LOGIN and PASSWORD are the values you configure hereTITLE, LINK and DESCRIPTION are the values that show in the title, link and description elements in the resulting RSS.

If you want to include the ENT classification, it gets a bit trickier.  I think this is how it should work:

s.metaWeblog.newPost(BLOGID, LOGIN, PASSWORD, {
    'title': TITLE,
    'link': LINK,
    'description': DESCRIPTION,
    'http://purl.org/NET/ENT/1.0/': {
        'cloud': {
            'href': "http://www.pmbrowser.info/rvw/",
            '_value': {
                'topic': {
                    'href': "http://www.pmbrowser.info/rvw/types.xtm#book",
                    'id': "book",
                    '_value': "Book",
                },
            },
        },

    },
})

I've never seen any code using this, but there are hooks in Radio (see radio.weblog.metaWeblog.* and weblogData.callbacks.*) for plugins to handle extra values, so it's likely that someone is using it somewhere.  The spec isn't clear as to whether namespaces have to be re-specified for attributes (e.g. the ent:href under the ent:cloud) or sub-elements (e.g. the ent:topic under the ent:cloud), so this looks a little weird.

Does anybody know of any real-life examples of this sort of thing?  I'd be very interested to hear from you, as I'm not at all sure if I got the above example correct.

... more like this: [, ]

Watch TCP sessions with this Windows build of tcpconndbg ...

Here's a build of tcpconndbg for Windows.

   tcpconndbg_win.zip

It lets you debug TCP applications. Say, if you want to watch your mail being sent, run it like this:

    tcpconndbg mailhost 25

(Replace mailhost with your SMTP server).

Now go into your mailer and change the SMTP server to localhost and the port to 8025, and try sending something. You should see the whole SMTP session in the window running tcpconndbg.

To see what IRC looks like on the wire, do this:

    tcpconndbg irc.freenode.net 6667

and in your IRC client:

    /server localhost 14667