zoukankan      html  css  js  c++  java
  • selenium对验证码识别校验解决方法

    1、进入https://www.showapi.com/apiGateway/view?apiCode=184 ,

    注:需注册,再购买此api,1毛钱玩一个月,看自身需求情况

    2、下载sdk,安装requests库,

    3、将ShowapiRequest.py文件放至项目中,根据需求复制所需java/python示例文件新建test.py,复制请求示例中的代码

    详情如下,

    my_appID和my_appSecret都均在我的应用-找到

    r.addBodyPara("typeId", "34")    -----34中的4 是指验证码英文+数字的个数

    # python3.6.5
    # 需要引入requests包 :运行终端->进入python/Scripts ->输入:pip install requests
    from lib.ShowapiRequest import ShowapiRequest
    
    r = ShowapiRequest("http://route.showapi.com/184-4","xxx","xxx" )
    r.addFilePara("image", "D:\TestSoftware\PyCharm\PyCharmProject\YSX\Utilsyzm2.png")
    r.addBodyPara("typeId", "34")
    r.addBodyPara("convert_to_jpg", "0")
    r.addBodyPara("needMorePrecise", "0")
    res = r.post()
    
    # print(res.text) # 返回信息
    # 输出:
    # {
    #     "showapi_res_error": "",
    #     "showapi_res_id": "5f548c188d57ba4a1d79e8af",
    #     "showapi_res_code": 0,
    #     "showapi_res_body": {"Result": "fh6d", "ret_code": 0, "Id": "sfat090-150-508-18f-cf0-06226af"}
    # }
    body = res.json()['showapi_res_body']
    print(body)
    #   输出为:
    #   {'Result': 'fh6d', 'ret_code': 0, 'Id': 'sfat090-150-508-615-f60-0567bc3'}
    print(body['Result'])
  • 相关阅读:
    java 测试 (junit+ junit 断言 + postman)
    junit 运行(eclipse + IDEA)
    junit 常用注解 + junit 断言详解
    工作周报模板
    spring boot tomcat 部署
    spring boot 集成JSP
    spring boot 集成 Mybatis,JPA
    JPA 常用注解
    员工年终绩效考核表模板
    2013 Noip提高组 Day1
  • 原文地址:https://www.cnblogs.com/c-jw/p/13806669.html
Copyright © 2011-2022 走看看