import urllib.request # 测试根路径 print("Testing root path...") try: response = urllib.request.urlopen('http://127.0.0.1:8000/') print(f"Status code: {response.status}") print(f"Response: {response.read().decode('utf-8')}") except Exception as e: print(f"Error: {e}") # 测试/docs路径 print("\nTesting /docs path...") try: response = urllib.request.urlopen('http://127.0.0.1:8000/docs') print(f"Status code: {response.status}") print(f"Response length: {len(response.read().decode('utf-8'))} characters") except Exception as e: print(f"Error: {e}")