试用了阿里云市场的验证码识别api,真的牛批,传统4位数验证码识别率超高

有钱是真的可以为所欲为

 

以后阿里云的api平台的确可以占有部分市场

验证码:

引入base64模块,识别后,传入此api

 

host = 'https://a************.showapi.com'
path = '/checkcode'
method = 'POST'
appcode = '***************************'
querys = ''
bodys = {}
url = host + path


bodys['convert_to_jpg'] = '0'
bodys['img_base64'] =ls_f
bodys['typeId'] = '14'
post_data = urllib.urlencode(bodys)
request = urllib2.Request(url, post_data)
request.add_header('Authorization', 'APPCODE ' + appcode)
#根据API的要求,定义相对应的Content-Type
request.add_header('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urllib2.urlopen(request, context=ctx)
content = response.read()
if (content):
    print(content)
输出结果:

 {"showapi_res_code":0,"showapi_res_error":"","showapi_res_body":{"Result":"8028","ret_code":0,"Id":"4a0909f1-019c-4cb5-834e-15a4e97fd32c"}}

2019年重新看了下,阿里云api市场上大多数验证码识别已经下架,但思路可用于调用各大平台的api

 

 

你可能感兴趣的:(python,爬虫,验证码识别)