test_quick_login.py 551 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env python3
  2. """
  3. 快速登录测试
  4. """
  5. import requests
  6. import json
  7. print("测试登录API...")
  8. try:
  9. response = requests.post(
  10. "http://localhost:8000/api/v1/auth/login",
  11. json={
  12. "username": "admin",
  13. "password": "Admin123456"
  14. },
  15. timeout=5
  16. )
  17. print(f"状态码: {response.status_code}")
  18. print(f"响应: {json.dumps(response.json(), indent=2, ensure_ascii=False)}")
  19. except Exception as e:
  20. print(f"错误: {e}")
  21. import traceback
  22. traceback.print_exc()