DDEで遊んでみる。

Debian Data Export というのがあるようだ。 配布資料は無いし、スライドは小っちゃくて見えない ので、とりあえず勝手に遊んでみる。取り合えず、apt-fileの情報を取るというURIで、dashを引数で渡してみる。

$ curl http://dde.debian.net/dde/q/aptfile/byfile/sid-amd64/dash
<html><body>
<h1>Packages containing dash</h1>

<p>Value:</p>
<pre>
['dash', 'debian-edu-config', 'sauerbraten-data']

</pre>
<ol>
</ol>
<p><a href='http://dde.debian.net/dde/q/aptfile/byfile/sid-amd64'>Go up one level</a></p>
</body></html>

デフォルトではHTML形式のようだ。apt-file show dashやapt-file search dashで得られる情報とも違う。

出力形式はいくつかあるのでいろいろ試してみる。

JSON

$ curl http://dde.debian.net/dde/q/aptfile/byfile/sid-amd64/dash?t=json
{"r":["dash","debian-edu-config","sauerbraten-data"]}

YAML

$ curl http://dde.debian.net/dde/q/aptfile/byfile/sid-amd64/dash?t=yaml
---
- dash
- debian-edu-config
- sauerbraten-data

CSV

$ curl http://dde.debian.net/dde/q/aptfile/byfile/sid-amd64/dash?t=csv
dash
debian-edu-config
sauerbraten-data

text

$ curl http://dde.debian.net/dde/q/aptfile/byfile/sid-amd64/dash?t=text
['dash', 'debian-edu-config', 'sauerbraten-data']

debug

$ curl http://dde.debian.net/dde/q/aptfile/byfile/sid-amd64/dash?t=debug
<body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#6622aa">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>&lt;type 'exceptions.TypeError'&gt;</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial">Python 2.5.2: /usr/bin/python<br>Sun Jul 26 11:53:12 2009</font></td></tr></table>

<p>A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.</p>
<table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr><td bgcolor="#d8bbff"><big>&nbsp;</big><a href="file:///var/lib/python-support/python2.5/flup/server/fcgi_base.py">/var/lib/python-support/python2.5/flup/server/fcgi_base.py</a> in <strong>run</strong>(self=&lt;flup.server.fcgi_base.Request object at 0x6000000000b2c390&gt;)</td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;&nbsp;556</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"""Runs&nbsp;the&nbsp;handler,&nbsp;flushes&nbsp;the&nbsp;streams,&nbsp;and&nbsp;ends&nbsp;the&nbsp;request."""<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;&nbsp;557</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try:<br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt><small>&nbsp;&nbsp;558</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;protocolStatus,&nbsp;appStatus&nbsp;=&nbsp;self.server.handler(self)<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;&nbsp;559</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;except:<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;&nbsp;560</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;traceback.print_exc(file=self.stderr)<br>
</tt></font></td></tr>
<tr><td><small><font color="#909090">protocolStatus <em>undefined</em>, appStatus <em>undefined</em>, <strong>self</strong>&nbsp;= &lt;flup.server.fcgi_base.Request object at 0x6000000000b2c390&gt;, self.<strong>server</strong>&nbsp;= &lt;flup.server.fcgi.WSGIServer object at 0x600000000086a6d0&gt;, self.server.<strong>handler</strong>&nbsp;= &lt;bound method WSGIServer.handler of &lt;flup.server.fcgi.WSGIServer object at 0x600000000086a6d0&gt;&gt;</font></small></td></tr></table>
<table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr><td bgcolor="#d8bbff"><big>&nbsp;</big><a href="file:///var/lib/python-support/python2.5/flup/server/fcgi_base.py">/var/lib/python-support/python2.5/flup/server/fcgi_base.py</a> in <strong>handler</strong>(self=&lt;flup.server.fcgi.WSGIServer object at 0x600000000086a6d0&gt;, req=&lt;flup.server.fcgi_base.Request object at 0x6000000000b2c390&gt;)</td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;1116</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result&nbsp;=&nbsp;self.application(environ,&nbsp;start_response)<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;1117</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try:<br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt><small>&nbsp;1118</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;data&nbsp;in&nbsp;result:<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;1119</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;data:<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;1120</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;write(data)<br>
</tt></font></td></tr>
<tr><td><small><font color="#909090">data <em>undefined</em>, <strong>result</strong>&nbsp;= &lt;generator object at 0x600000000086bb00&gt;</font></small></td></tr></table>
<table width="100%" cellspacing=0 cellpadding=0 border=0>
<tr><td bgcolor="#d8bbff"><big>&nbsp;</big><a href="file:///org/dde.debian.net/home/dde/dde/wsgi.py">/org/dde.debian.net/home/dde/dde/wsgi.py</a> in <strong>handle_debug</strong>(self=&lt;dde.wsgi.DDE object at 0x6000000000536310&gt;, res=&lt;dde.wsgi.Result instance at 0x6000000000993b48&gt;, args=('aptfile', 'byfile', 'sid-amd64', 'dash'), kw={'t': 'debug'})</td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;&nbsp;405</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;handle_debug(self,&nbsp;res,&nbsp;args,&nbsp;kw):<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;&nbsp;406</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;body&nbsp;=&nbsp;"Args:&nbsp;"&nbsp;+&nbsp;repr(args)&nbsp;+&nbsp;"&nbsp;kw:&nbsp;"&nbsp;+&nbsp;repr(kw)<br>
</tt></font></td></tr>
<tr><td bgcolor="#ffccee"><tt><small>&nbsp;&nbsp;407</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;res.start_response(type&nbsp;=&nbsp;"text/plain",&nbsp;len&nbsp;=&nbsp;len(body))<br>
</tt></td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;&nbsp;408</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;yield&nbsp;res<br>
</tt></font></td></tr>
<tr><td><font color="#909090"><tt><small>&nbsp;&nbsp;409</small>&nbsp;<br>
</tt></font></td></tr>
<tr><td><small><font color="#909090"><strong>res</strong>&nbsp;= &lt;dde.wsgi.Result instance at 0x6000000000993b48&gt;, res.<strong>start_response</strong>&nbsp;= &lt;bound method Result.start_response of &lt;dde.wsgi.Result instance at 0x6000000000993b48&gt;&gt;, <em>builtin</em> <strong>type</strong>&nbsp;= &lt;type 'type'&gt;, <em>builtin</em> <strong>len</strong>&nbsp;= &lt;built-in function len&gt;, <strong>body</strong>&nbsp;= "Args: ('aptfile', 'byfile', 'sid-amd64', 'dash') kw: {'t': 'debug'}"</font></small></td></tr></table><p><strong>&lt;type 'exceptions.TypeError'&gt;</strong>: start_response() got an unexpected keyword argument 'len'
<br><tt><small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</small>&nbsp;</tt>args&nbsp;=
("start_response() got an unexpected keyword argument 'len'",)
<br><tt><small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</small>&nbsp;</tt>message&nbsp;=
"start_response() got an unexpected keyword argument 'len'"

pickleとかいうのもあるらしいが、文字化けしたので省略。何の情報をとっているのかよく分からんな。もうちょい遊んで調べてみるか。