import requests, json, redis, sys sys.stdout.reconfigure(encoding='utf-8') s = requests.Session() r = s.get('http://localhost:18080/healthlink-his/captchaImage') captcha = r.json() login_data = { 'username': 'admin', 'password': 'admin123', 'code': '1', 'uuid': captcha.get('uuid', '') } r = s.post('http://localhost:18080/healthlink-his/login', json=login_data) resp = r.json() print('Login code:', resp.get('code')) msg = resp.get('msg', '') print('Login msg:', msg[:200] if msg else 'none') token = resp.get('token', '') print('Token:', token[:30] if token else 'none') # Check Redis r2 = redis.Redis(host='192.168.110.252', port=6379, password='Jchl1528', db=1, socket_timeout=5) keys = r2.keys('login_tokens:*') print('Login tokens in Redis:', len(keys)) for k in keys[:3]: raw = r2.get(k) if raw: s2 = raw.decode('utf-8', errors='replace')[:200] print(' ' + s2[:200])