MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / _api_test

Method _api_test

simple_launcher.py:899–923  ·  view source on GitHub ↗

Test the API

(self)

Source from the content-addressed store, hash-verified

897 messagebox.showerror("Error", f"Account could not be deleted:\n{e}")
898
899 def _api_test(self):
900 """Test the API"""
901 port = self.fastapi_port.get()
902 url = f"http://127.0.0.1:{port}/health"
903
904 self._log(f"🔍 Testing API: {url}")
905
906 try:
907 import urllib.request
908
909 with urllib.request.urlopen(url, timeout=5) as response:
910 if response.status == 200:
911 self._log("✅ API is running!")
912 self.status_details.config(text="✅ API is active and responding")
913 messagebox.showinfo("Success", "API is running! ✅")
914 else:
915 self._log(f"⚠️ API responded but status code: {response.status}")
916 except urllib.error.URLError:
917 self._log("❌ Could not connect to API. Service may not be running.")
918 self.status_details.config(text="❌ API is not responding")
919 messagebox.showwarning(
920 "Warning", "Could not connect to API.\nIs the service running?"
921 )
922 except Exception as e:
923 self._log(f"❌ API test error: {e}")
924
925 def _open_in_browser(self):
926 """Open API in browser"""

Callers

nothing calls this directly

Calls 3

_logMethod · 0.95
configMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected