<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: election code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 18 May 2008 07:00:40 GMT</pubDate>
    <description>DZone Snippets: election code</description>
    <item>
      <title>Thai election ID checking</title>
      <link>http://snippets.dzone.com/posts/show/1716</link>
      <description>The online service &lt;a href=http://www.dopa.go.th/online/inqelect.htm&gt;here&lt;/a&gt; aims to help people&lt;br /&gt;check where they are to vote. However, it can be&lt;br /&gt;used as ID certification as well.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# nnnn is the id to be checked&lt;br /&gt;http://www.dopa.go.th/cgi-bin/inqelect.sh?pid=nnnn&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Here I make it into a function call.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import urllib, re&lt;br /&gt;def getname(id):&lt;br /&gt;  url = 'http://www.dopa.go.th/cgi-bin/inqelect.sh?pid=' + str(id)&lt;br /&gt;  src = urllib.urlopen(url).read()&lt;br /&gt;  pat = '&lt;H3&gt; *(.*?) *&lt;'&lt;br /&gt;  name = re.findall(pat, src)[0]  # don't use other info&lt;br /&gt;  return name&lt;br /&gt;&lt;br /&gt;print getname(5100900050063)  # show a name (one of my relatives)&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 19 Mar 2006 16:30:32 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1716</guid>
      <author>korakot (Korakot Chaovavanich)</author>
    </item>
  </channel>
</rss>
