联众打码
C++aptcha.py
import requests
from base64 import b64encode
class captchaApi:
def __init__(self, username, password):
self.__username = username
self.__password = password
self.__software_id = 联众软件ID
self.__software_secret = 联众软件秘钥
self.__captcha_id = None
self.__type = {
'12306': '1303',
}
def decode(self, file_name, mark=None):
url = 'HTTPs://v2-api.jsdama.com/upload'
with open(file_name, 'rb') as f:
captcha = b64encode(f.read()).decode()
mark = mark or self.__type['12306']
data = {
'softwareId': self.__software_id,
'softwareSecret': self.__software_secret,
'username': self.__username,
'password': self.__password,
'captchaData': captcha,
'captchaType': mark
# 'captchaMinLength': 1,
# 'captchaMaxLength': 8,
}
response = requests.post(url, json=data).json()
if response['code'] == 0:
code = response['data']['recognition']
self.__captcha_id = response['data']['captchaid']
return ','.join(code.split('|'))
else:
print(response['message'])
def report_ERROR(self):
url = 'https://v2-api.jsdama.com/report-error'
data = {
'softwareId': self.__software_id,
'softwareSecret': self.__software_secret,
'username': self.__username,
'password': self.__password,
'captchaId': self.__captcha_id,
}
response = requests.post(url, json=data).json()
if response['data']['result']:
print('报错成功!')
jsdati = CaptchaApi('联众账号', '联众密码')
if __name__ == '__main__':
import os
ans = jsdati.decode(os.path.join(os.path.dirname(__file__), 'code.png'))
print(ans)
相关阅读
网络世界悄无声息的融入了现实世界,渐渐成为我们必不可少的成分,我们能在网络上解决吃喝问题,当然也能在网上解决赚钱的问题,作为一个