增加用户本地打码平台配置
This commit is contained in:
@@ -28,7 +28,8 @@ QUERY_JOB_THREAD_ENABLED = 0 # 是否开启多线程查询,开启后第个任
|
|||||||
|
|
||||||
# 打码平台账号
|
# 打码平台账号
|
||||||
# 目前只支持免费打码接口 和 若快打码,注册地址:http://www.ruokuai.com/login
|
# 目前只支持免费打码接口 和 若快打码,注册地址:http://www.ruokuai.com/login
|
||||||
AUTO_CODE_PLATFORM = 'free' # 免费填写 free 若快 ruokuai # 免费打码无法保证持续可用,如失效请手动切换
|
AUTO_CODE_PLATFORM = 'free' # 免费填写 free 若快 ruokuai # 免费打码无法保证持续可用,如失效请手动切换 #个人本地打码填写 user,并修改 API_USER_CODE_QCR_API
|
||||||
|
API_USER_CODE_QCR_API = ''
|
||||||
AUTO_CODE_ACCOUNT = {
|
AUTO_CODE_ACCOUNT = {
|
||||||
'user': 'your user name',
|
'user': 'your user name',
|
||||||
'pwd': 'your password'
|
'pwd': 'your password'
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ QUERY_JOB_THREAD_ENABLED = 0 # 是否开启多线程查询,开启后第个任
|
|||||||
|
|
||||||
# 打码平台账号
|
# 打码平台账号
|
||||||
# 目前只支持免费打码接口 和 若快打码,注册地址:http://www.ruokuai.com/login
|
# 目前只支持免费打码接口 和 若快打码,注册地址:http://www.ruokuai.com/login
|
||||||
AUTO_CODE_PLATFORM = 'free' # 免费填写 free 若快 ruokuai # 免费打码无法保证持续可用,如失效请手动切换
|
AUTO_CODE_PLATFORM = 'free' # 免费填写 free 若快 ruokuai # 免费打码无法保证持续可用,如失效请手动切换; 个人打码填写 user 并修改API_USER_CODE_QCR_API 为自己地址
|
||||||
|
API_USER_CODE_QCR_API = ''
|
||||||
AUTO_CODE_ACCOUNT = { # 使用 free 可用省略
|
AUTO_CODE_ACCOUNT = { # 使用 free 可用省略
|
||||||
'user': 'your user name',
|
'user': 'your user name',
|
||||||
'pwd': 'your password'
|
'pwd': 'your password'
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class App:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def check_auto_code(cls):
|
def check_auto_code(cls):
|
||||||
if Config().AUTO_CODE_PLATFORM == 'free': return True
|
if Config().AUTO_CODE_PLATFORM == 'free' or Config().AUTO_CODE_PLATFORM == 'user': return True
|
||||||
if not Config().AUTO_CODE_ACCOUNT.get('user') or not Config().AUTO_CODE_ACCOUNT.get('pwd'):
|
if not Config().AUTO_CODE_ACCOUNT.get('user') or not Config().AUTO_CODE_ACCOUNT.get('pwd'):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ class Config:
|
|||||||
QUERY_JOB_THREAD_ENABLED = 0
|
QUERY_JOB_THREAD_ENABLED = 0
|
||||||
# 打码平台账号
|
# 打码平台账号
|
||||||
AUTO_CODE_PLATFORM = ''
|
AUTO_CODE_PLATFORM = ''
|
||||||
|
#用户打码平台地址
|
||||||
|
API_USER_CODE_QCR_API = ''
|
||||||
AUTO_CODE_ACCOUNT = {'user': '', 'pwd': ''}
|
AUTO_CODE_ACCOUNT = {'user': '', 'pwd': ''}
|
||||||
# 输出日志到文件
|
# 输出日志到文件
|
||||||
OUT_PUT_LOG_TO_FILE_ENABLED = 0
|
OUT_PUT_LOG_TO_FILE_ENABLED = 0
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class OCR:
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
self = cls()
|
self = cls()
|
||||||
if Config().AUTO_CODE_PLATFORM == 'free':
|
if Config().AUTO_CODE_PLATFORM == 'free' or Config().AUTO_CODE_PLATFORM == 'user':
|
||||||
return self.get_image_by_free_site(img)
|
return self.get_image_by_free_site(img)
|
||||||
return self.get_img_position_by_ruokuai(img)
|
return self.get_img_position_by_ruokuai(img)
|
||||||
|
|
||||||
@@ -58,7 +58,10 @@ class OCR:
|
|||||||
data = {
|
data = {
|
||||||
'img': img
|
'img': img
|
||||||
}
|
}
|
||||||
response = self.session.post(API_FREE_CODE_QCR_API, data=data, timeout=30)
|
if Config().AUTO_CODE_PLATFORM == 'free':
|
||||||
|
response = self.session.post(API_FREE_CODE_QCR_API, data=data, timeout=30)
|
||||||
|
else:
|
||||||
|
response = self.session.post(Config().API_USER_CODE_QCR_API, data=data, timeout=30)
|
||||||
result = response.json()
|
result = response.json()
|
||||||
if result.get('msg') == 'success':
|
if result.get('msg') == 'success':
|
||||||
pos = result.get('result')
|
pos = result.get('result')
|
||||||
|
|||||||
Reference in New Issue
Block a user