MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / ping

Function ping

ui/easydiffusion/backends/webui_common.py:89–119  ·  view source on GitHub ↗

timeout (in seconds)

(timeout=1)

Source from the content-addressed store, hash-verified

87
88
89def ping(timeout=1):
90 "timeout (in seconds)"
91
92 global webui_opts
93
94 try:
95 res = webui_get("/internal/ping", timeout=timeout)
96
97 if res.status_code != 200:
98 raise ConnectTimeout(res.text)
99
100 if webui_opts is None:
101 try:
102 res = webui_post("/sdapi/v1/options", json=DEFAULT_WEBUI_OPTIONS)
103 if res.status_code != 200:
104 raise Exception(res.text)
105 except Exception as e:
106 print(f"Error setting options: {e}")
107
108 try:
109 res = webui_get("/sdapi/v1/options")
110 if res.status_code != 200:
111 raise Exception(res.text)
112
113 webui_opts = res.json()
114 except Exception as e:
115 print(f"Error getting options: {e}")
116
117 return True
118 except (ConnectTimeout, ConnectionError, ReadTimeout) as e:
119 raise TimeoutError(e)
120
121
122def load_model(context, model_type, **kwargs):

Callers 1

Calls 3

webui_getFunction · 0.85
webui_postFunction · 0.85
jsonMethod · 0.45

Tested by

no test coverage detected