RAGFlow CLI: ping server before input password when login user (#12791)

### What problem does this PR solve?

As title

### Type of change

- [x] Refactoring

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-01-23 15:03:05 +08:00
committed by GitHub
parent 08c01b76d5
commit e1df82946e
2 changed files with 37 additions and 27 deletions

View File

@ -50,6 +50,18 @@ class RAGFlowClient:
self.server_type = server_type
def login_user(self, command):
try:
response = self.http_client.request("GET", "/system/ping", use_api_base=False, auth_kind="web")
if response.status_code == 200 and response.content == b"pong":
pass
else:
print("Server is down")
return
except Exception as e:
print(str(e))
print("Can't access server for login (connection failed)")
return
email : str = command["email"]
user_password = getpass.getpass(f"password for {email}: ").strip()
try: