超级鹰打码平台

超级鹰打码平台

稍稍改写了一下他的demo,用的话直接调用get_code()函数就可以了

新用户还给1000题分测试用,用户名密码填写自己的,验证码类型查看

 1 #!/usr/bin/env python
 2 # coding:utf-8
 3 
 4 import requests
 5 from hashlib import md5
 6 
 7 
 8 class Chaojiying_Client(object):
 9 
10     def __init__(self, username, password, soft_id):
11         self.username = username
12         password =  password.encode('utf-8')
13         self.password = md5(password).hexdigest()
14         self.soft_id = soft_id
15         self.base_params = {
16             'user': self.username,
17             'pass2': self.password,
18             'softid': self.soft_id,
19         }
20         self.headers = {
21             'Connection': 'Keep-Alive',
22             'User-Agent': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
23         }
24 
25     def PostPic(self, im, codetype):
26         """
27         im: 图片字节
28         codetype: 题目类型 参考 http://www.chaojiying.com/price.html
29         """
30         params = {
31             'codetype': codetype,
32         }
33         params.update(self.base_params)
34         files = {'userfile': ('ccc.jpg', im)}
35         r = requests.post('http://upload.chaojiying.net/Upload/Processing.php', data=params, files=files, headers=self.headers)
36         return r.json()
37 
38     def ReportError(self, im_id):
39         """
40         im_id:报错题目的图片ID
41         """
42         params = {
43             'id': im_id,
44         }
45         params.update(self.base_params)
46         r = requests.post('http://upload.chaojiying.net/Upload/ReportError.php', data=params, headers=self.headers)
47         return r.json()
48 
49     def get_code():
50         chaojiying = Chaojiying_Client('用户名', '密码', '验证码类型')
51         im = open('要识别的图片的路径', 'rb').read()
52         return chaojiying.PostPic(im, 3004)['pic_str']
53 
54 
55 
56     

 

转载于:https://www.cnblogs.com/MC-Curry/p/9592598.html

你可能感兴趣的:(超级鹰打码平台)