Thai election ID checking
check where they are to vote. However, it can be
used as ID certification as well.
1 2 # nnnn is the id to be checked 3 http://www.dopa.go.th/cgi-bin/inqelect.sh?pid=nnnn
Here I make it into a function call.
1 2 import urllib, re 3 def getname(id): 4 url = 'http://www.dopa.go.th/cgi-bin/inqelect.sh?pid=' + str(id) 5 src = urllib.urlopen(url).read() 6 pat = '<H3> *(.*?) *<' 7 name = re.findall(pat, src)[0] # don't use other info 8 return name 9 10 print getname(5100900050063) # show a name (one of my relatives)