crac

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

统计

使用百度ocr接口识别验证码

#!/usr/bin/env python
#created by Baird

from aip import AipOcr

def GetCaptchaV(filename):
    APP_ID = '1X4X8X4X'
    API_KEY = 'YaVcqamctoYqRHNGAqwVbn97UO'
    SECRET_KEY = 'C1926rIqGstqPHTUFa6sz481fjDua2pv'

    client = AipOcr(APP_ID, API_KEY, SECRET_KEY)

    """ 读取图片 """
    def get_file_content(filePath):
        with open(filePath, 'rb') as fp:
            return fp.read()

    image = get_file_content(filename)

    """ 调用通用文字识别, 图片参数为本地图片 """
    ret = client.basicGeneral(image)

    code = ret["words_result"][0]["words"]
    print("识别验证码成功===》",code)
    return code

  

posted on   crac  阅读(3672)  评论(0编辑  收藏  举报

点击右上角即可分享
微信分享提示