以第三方斐斐打码接口为例(此方法只学习使用)
#!/usr/bin/python3
# coding=utf-8
# Author: 文
from re import match
from io import BytesIO
from time import time
import base64
import hashlib
import requests
class GetCode():
def __init__(self):
self.stamp = str(int(time()))
self.s = requests.session()
self.api_url = "http://pred.fateadm.com/api/capreg" # 图文验证码识别接口
def calcSign(self, pd_id, passwd, timestamp):
"""
# MD5加密获取sign
:param pd_id: 斐斐打码PD账号
:param passwd: 斐斐打码PD密钥
:param timestamp: 当前时间戳
:return: 返回md5加密结果
"""
md5 = hashlib.md5()
md5.update((timestamp + passwd).encode()) # 转码后加密
csign = md5.hexdigest() # 返回摘要,作为十六进制数据字符串值
md5 = hashlib.md5()
md5.update((pd_id + timestam