|
|
@@ -288,7 +288,7 @@ def compare():
|
|
|
try:
|
|
|
reqjson = request.get_json()
|
|
|
except Exception as ignore:
|
|
|
- return R("","参数出错",status.HTTP_400_BAD_REQUEST)
|
|
|
+ return R("","params error",status.HTTP_400_BAD_REQUEST)
|
|
|
same = None
|
|
|
ossClient = OssClient()
|
|
|
try:
|
|
|
@@ -301,7 +301,7 @@ def compare():
|
|
|
os.remove(file1)
|
|
|
os.remove(file2)
|
|
|
except Exception as ignore:
|
|
|
- return R("","服务出错",status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
|
+ return R("","server error",status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
|
# callback
|
|
|
callback_json={
|
|
|
"userId": reqjson["userId"],
|
|
|
@@ -317,17 +317,19 @@ def compare():
|
|
|
requests.post(
|
|
|
url=face_callback,
|
|
|
data=None,
|
|
|
- json=callback_json
|
|
|
+ json=callback_json,
|
|
|
+ timeout=5
|
|
|
)
|
|
|
elif not same:
|
|
|
requests.post(
|
|
|
url=face_callback,
|
|
|
data=None,
|
|
|
- json=callback_json
|
|
|
+ json=callback_json,
|
|
|
+ timeout=5
|
|
|
)
|
|
|
return R(same, "")
|
|
|
else:
|
|
|
- return R("","无效的请求类型",status.HTTP_400_BAD_REQUEST)
|
|
|
+ return R("","invalid request",status.HTTP_400_BAD_REQUEST)
|
|
|
|
|
|
# API /number
|
|
|
|
|
|
@@ -357,16 +359,17 @@ def number():
|
|
|
try:
|
|
|
reqjson = request.get_json()
|
|
|
except Exception as ignore:
|
|
|
- return R("","参数出错",status.HTTP_400_BAD_REQUEST)
|
|
|
+ return R("","params error",status.HTTP_400_BAD_REQUEST)
|
|
|
number = None
|
|
|
ossClient = OssClient()
|
|
|
try:
|
|
|
file1 = generate_random_str()
|
|
|
ossClient.downloadFileToLocal(reqjson["info"]["number"], file1)
|
|
|
number = checkNum(reqjson["info"]["number"],file1)
|
|
|
+ print('number:', number)
|
|
|
os.remove(file1)
|
|
|
except Exception as ignore:
|
|
|
- return R("","服务出错",status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
|
+ return R("","server error",status.HTTP_500_INTERNAL_SERVER_ERROR)
|
|
|
# callback
|
|
|
callback_json={
|
|
|
"userId": reqjson["userId"],
|
|
|
@@ -381,11 +384,12 @@ def number():
|
|
|
requests.post(
|
|
|
url=number_callback,
|
|
|
data=None,
|
|
|
- json=callback_json
|
|
|
+ json=callback_json,
|
|
|
+ timeout=5
|
|
|
)
|
|
|
return R(number, "")
|
|
|
else:
|
|
|
- return R("","无效的请求类型",status.HTTP_400_BAD_REQUEST)
|
|
|
+ return R("","invalid request",status.HTTP_400_BAD_REQUEST)
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|