DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Thai Election ID Checking
The online service <a href=http://www.dopa.go.th/online/inqelect.htm>here</a> aims to help people
check where they are to vote. However, it can be
used as ID certification as well.
# nnnn is the id to be checked http://www.dopa.go.th/cgi-bin/inqelect.sh?pid=nnnn
Here I make it into a function call.
import urllib, re def getname(id): url = 'http://www.dopa.go.th/cgi-bin/inqelect.sh?pid=' + str(id) src = urllib.urlopen(url).read() pat = '<H3> *(.*?) *<' name = re.findall(pat, src)[0] # don't use other info return name print getname(5100900050063) # show a name (one of my relatives)





