mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Unified API response json schema (#3170)
### What problem does this PR solve? Unified API response json schema ### Type of change - [x] Refactoring
This commit is contained in:
@ -25,16 +25,16 @@ def register():
|
||||
register_data = {"email":EMAIL,"nickname":name,"password":PASSWORD}
|
||||
res = requests.post(url=url,json=register_data)
|
||||
res = res.json()
|
||||
if res.get("retcode") != 0:
|
||||
raise Exception(res.get("retmsg"))
|
||||
if res.get("code") != 0:
|
||||
raise Exception(res.get("message"))
|
||||
|
||||
def login():
|
||||
url = HOST_ADDRESS + "/v1/user/login"
|
||||
login_data = {"email":EMAIL,"password":PASSWORD}
|
||||
response=requests.post(url=url,json=login_data)
|
||||
res = response.json()
|
||||
if res.get("retcode")!=0:
|
||||
raise Exception(res.get("retmsg"))
|
||||
if res.get("code")!=0:
|
||||
raise Exception(res.get("message"))
|
||||
auth = response.headers["Authorization"]
|
||||
return auth
|
||||
|
||||
@ -46,7 +46,7 @@ def get_api_key_fixture():
|
||||
auth = {"Authorization": auth}
|
||||
response = requests.post(url=url,headers=auth)
|
||||
res = response.json()
|
||||
if res.get("retcode") != 0:
|
||||
raise Exception(res.get("retmsg"))
|
||||
if res.get("code") != 0:
|
||||
raise Exception(res.get("message"))
|
||||
return res["data"].get("token")
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
{"data":null,"retcode":100,"retmsg":"TypeError(\"download_document() got an unexpected keyword argument 'tenant_id'\")"}
|
||||
{"data":null,"code":100,"message":"TypeError(\"download_document() got an unexpected keyword argument 'tenant_id'\")"}
|
||||
|
||||
Reference in New Issue
Block a user