- from urllib import urlencode
- import urllib2
- import json
- url = 'http://api.uihoo.com/idcard/idcard.http.php'
- def Bool_CheckID(ID):
- data = {}
- data['idnumber'] = ID
- data['format'] = 'json'
- IDdata = urlencode(data)
- response = urllib2.urlopen(url,IDdata)
- rsp = json.loads(response.read())
- if rsp['error'] == 0:
- return True
- else:
- return False
- #该片段来自于http://www.codesnippet.cn/detail/0311201410870.html
来源: http://www.codesnippet.cn/detail/0311201410870.html