|
@@ -1,4 +1,5 @@
|
|
|
import requests
|
|
|
+import setting
|
|
|
|
|
|
__all__ = [
|
|
|
"swordfish_platform",
|
|
@@ -32,7 +33,7 @@ def _simple_captcha(file):
|
|
|
@param file: 验证码 - 可以是图片或者图片base64编码
|
|
|
@return:
|
|
|
"""
|
|
|
- url = "http://pycaptcha.spdata.jianyu360.com/v1/images/verify"
|
|
|
+ url = f"{setting.CAPTCHA_URL}/v1/images/verify"
|
|
|
files = _pack_file(file)
|
|
|
r = requests.post(url, headers=headers, files=files, stream=True, timeout=10)
|
|
|
rp_json = r.json()
|
|
@@ -43,7 +44,7 @@ def _simple_captcha(file):
|
|
|
|
|
|
def _arithmetic_captcha(file):
|
|
|
"""算术验证码"""
|
|
|
- url = "http://pycaptcha.spdata.jianyu360.com/v1/images/arithmetic"
|
|
|
+ url = f"{setting.CAPTCHA_URL}/v1/images/arithmetic"
|
|
|
files = _pack_file(file)
|
|
|
r = requests.post(url, headers=headers, files=files, stream=True, timeout=10)
|
|
|
json_resp = r.json()
|
|
@@ -54,7 +55,7 @@ def _arithmetic_captcha(file):
|
|
|
|
|
|
def _get_click_verify_captcha(file):
|
|
|
"""点触式验证码"""
|
|
|
- url = "http://pycaptcha.spdata.jianyu360.com/v1/images/verify_det"
|
|
|
+ url = f"{setting.CAPTCHA_URL}/v1/images/verify_det"
|
|
|
files = {"image_content": v for k, v in _pack_file(file).items()}
|
|
|
r = requests.post(url, headers=headers, files=files, stream=True, timeout=10)
|
|
|
return r.json()
|
|
@@ -77,7 +78,7 @@ def chaojiying_platform(file, pic_type: int):
|
|
|
pic_type,详情查询地址: https://www.chaojiying.com/price.html
|
|
|
"""
|
|
|
files = _pack_file(file)
|
|
|
- url = f"http://pycaptcha.spdata.jianyu360.com/v1/images/discern?pic_type={pic_type}"
|
|
|
+ url = f"{setting.CAPTCHA_URL}/v1/images/discern?pic_type={pic_type}"
|
|
|
headers = {'accept': 'application/json'}
|
|
|
data = {
|
|
|
'grant_type': '',
|
|
@@ -99,7 +100,7 @@ def chaojiying_platform(file, pic_type: int):
|
|
|
|
|
|
def chaojiying_report(pic_id: str):
|
|
|
"""超级鹰平台识别验证码错误时,提交识别错误的验证码pic_id"""
|
|
|
- url = f"http://pycaptcha.spdata.jianyu360.com/v1/images/report_err?pic_id={pic_id}"
|
|
|
+ url = f"{setting.CAPTCHA_URL}/v1/images/report_err?pic_id={pic_id}"
|
|
|
headers = {
|
|
|
'accept': 'application/json',
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|