云打码实现验证码识别功能_打验证码赚钱真的吗

云打码实现验证码识别功能_打验证码赚钱真的吗云打码官网:http://www.yundama.com/API接口:http://www.yundama.com/apidoc/YDM_SDK.html#DEMO以下验证码识别使用的”pythonHTTP“方法:1.注册开发者账号,进入开发者中心,点击”我的软件“→”添加新软件“,获取软件代码和通讯密钥;2.调用示例:importhttp.client,mimetype…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

云打码官网:http://www.yundama.com/

API接口:http://www.yundama.com/apidoc/YDM_SDK.html#DEMO

以下验证码识别使用的”pythonHTTP“方法:

1.注册开发者账号,进入开发者中心,点击”我的软件“→”添加新软件“,获取软件代码和通讯密钥;

2.调用示例:

import http.client, mimetypes, urllib, json, time, requests

######################################################################

class YDMHttp:

    apiurl = 'http://api.yundama.com/api.php'
    username = ''											#用户名
    password = ''											#用户密码
    appid = ''												#填写开发者软件代码
    appkey = ''												#填写开发者通讯密钥

    def __init__(self, username, password, appid, appkey):
        self.username = username  
        self.password = password
        self.appid = str(appid)
        self.appkey = appkey

    def request(self, fields, files=[]):
        response = self.post_url(self.apiurl, fields, files)
        response = json.loads(response)
        return response
    
    def balance(self):
        data = {'method': 'balance', 'username': self.username, 'password': self.password, 'appid': self.appid, 'appkey': self.appkey}
        response = self.request(data)
        if (response):
            if (response['ret'] and response['ret'] < 0):
                return response['ret']
            else:
                return response['balance']
        else:
            return -9001
    
    def login(self):
        data = {'method': 'login', 'username': self.username, 'password': self.password, 'appid': self.appid, 'appkey': self.appkey}
        response = self.request(data)
        if (response):
            if (response['ret'] and response['ret'] < 0):
                return response['ret']
            else:
                return response['uid']
        else:
            return -9001

    def upload(self, filename, codetype, timeout):
        data = {'method': 'upload', 'username': self.username, 'password': self.password, 'appid': self.appid, 'appkey': self.appkey, 'codetype': str(codetype), 'timeout': str(timeout)}
        file = {'file': filename}
        response = self.request(data, file)
        if (response):
            if (response['ret'] and response['ret'] < 0):
                return response['ret']
            else:
                return response['cid']
        else:
            return -9001

    def result(self, cid):
        data = {'method': 'result', 'username': self.username, 'password': self.password, 'appid': self.appid, 'appkey': self.appkey, 'cid': str(cid)}
        response = self.request(data)
        return response and response['text'] or ''

    def decode(self, filename, codetype, timeout):
        cid = self.upload(filename, codetype, timeout)
        if (cid > 0):
            for i in range(0, timeout):
                result = self.result(cid)
                if (result != ''):
                    return cid, result
                else:
                    time.sleep(1)
            return -3003, ''
        else:
            return cid, ''

    def report(self, cid):
        data = {'method': 'report', 'username': self.username, 'password': self.password, 'appid': self.appid, 'appkey': self.appkey, 'cid': str(cid), 'flag': '0'}
        response = self.request(data)
        if (response):
            return response['ret']
        else:
            return -9001

    def post_url(self, url, fields, files=[]):
        for key in files:
            files[key] = open(files[key], 'rb');
        res = requests.post(url, files=files, data=fields)
        return res.text

######################################################################

# 用户名
username    = 'username'

# 密码
password    = 'password'                            

# 软件ID,开发者分成必要参数。登录开发者后台【我的软件】获得!
appid       = 1                                     

# 软件密钥,开发者分成必要参数。登录开发者后台【我的软件】获得!
appkey      = '22cc5376925e9387a23cf797cb9ba745'    

# 图片文件
filename    = 'getimage.jpg'                        

# 验证码类型,# 例:1004表示4位字母数字,不同类型收费不同。请准确填写,否则影响识别率。在此查询所有类型 http://www.yundama.com/price.html
codetype    = 1004

# 超时时间,秒
timeout     = 60                                    

# 检查
if (username == 'username'):
    print('请设置好相关参数再测试')
else:
    # 初始化
    yundama = YDMHttp(username, password, appid, appkey)

    # 登陆云打码
    uid = yundama.login();
    print('uid: %s' % uid)

    # 查询余额
    balance = yundama.balance();
    print('balance: %s' % balance)

    # 开始识别,图片路径,验证码类型ID,超时时间(秒),识别结果
    cid, result = yundama.decode(filename, codetype, timeout);
    print('cid: %s, result: %s' % (cid, result))

######################################################################

Jetbrains全家桶1年46,售后保障稳定

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/200904.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • PHP安装curl扩展

    昨天在写文章的时候,突然出现了一个很顽皮的bug。一直跳到404页面???于是我赶紧打开debug,看看什么情况!弹出的错误是:CalltoundefinedfunctionHome\Controller\curl_init()原来是curl扩展没有装……(ps:之前写文章的时候都没出现过这个情况,很顽皮~)来记录一下安装过程吧:…

    2022年4月5日
    50
  • 大疆网上测评题库_一份完整的大疆2018校招笔试题和面经送给大家~

    大疆网上测评题库_一份完整的大疆2018校招笔试题和面经送给大家~听说周日大疆就要笔试了,今年的秋招来的有点让人猝不及防啊,牛客的各种讨论群里都弥漫着一种恐惧的氛围,我是谁,我在哪,我该怎么办(惊恐脸)。。。。。哈哈哈没关系,作为一个刚刚踏上工作岗位的老学长,去年秋招在牛客网收获颇丰,是时候来回馈一波牛客网,回报一下牛妹了;)话不多说,干货奉上2018秋招大疆机器学习、算法笔试题1、两个小车,走一步能量消耗1,方向为1向右,-1为向左,首先输入路途长度,然后输…

    2022年6月29日
    94
  • NVIC中断管理

    NVIC中断管理使用中断之前,第一步要了解的是其优先级管理,下面总结一下STM32NVIC的中断优先级管理。(正点原子系列)以smt32f103系列为例,其具有16个内核中断和60个可屏蔽中断。下面介绍其库函数的开发:MDK内与NVIC相关的寄存器包含在结构体中,通过创建结构体,配置其内部组成员也就是寄存器,来配置NVIC各个配置。先介绍其结构体的内部内容:在结构体内有介绍!中断配置寄存器[]内的…

    2022年5月27日
    68
  • 串口服务器调试助手使用教程,如何配置串口服务器及串口调试的六个技巧

    串口服务器调试助手使用教程,如何配置串口服务器及串口调试的六个技巧串口服务器如何配置,很多用户都不清楚。今天,本文总结和阐述了如何配置串口服务器和串口调试的六个技巧:1.如何设置串口服务器的串口属性,比如波特率参数和数值?点击屏幕上的“设备”单元;手动键入“程序设置”;手动选择“程序”,最后手动输入“串口参数”。2.串口服务器怎么配置?首先要熟悉自己的操作环境和应用配置参数(熟悉各个串口的工作模式,熟悉主要参数中包含的网络参数,设备本身的信息内容,打印服务等相关…

    2022年6月3日
    51
  • MySQL最全整理!西安java培训机构排名榜

    MySQL最全整理!西安java培训机构排名榜MySQL为何不选择平衡二叉树既然平衡二叉树解决了普通二叉树的问题,那么mysql为何不选择平衡二叉树作为索引呢?索引需要存储什么让我们想一想,如果我们要把索引存起来,那么应该存哪些信息呢,它应该存储三块信息:索引的值:就是表里面索引列对应的值。数据的磁盘地址(通过磁盘地址找到当前数据)或者直接存储整条数据。子节点的引用:我们需要从根节点往下走,所以需要知道左右子节点的地址。根据这三点,可以有如下大致的一个简单的结构图:上图中数字表示的是索引的值,0x开头的表示磁盘地址,根

    2022年9月25日
    0
  • 汉语转彝族语_别知己的彝语翻译汉语意思

    汉语转彝族语_别知己的彝语翻译汉语意思https://www.zhihu.com/question/67981381/answer/276584599作者:少学汉链接:https://www.zhihu.com/question/679

    2022年8月3日
    4

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号