MCPcopy Create free account
hub / github.com/openai/openai-agents-python / redis_ping_url

Function redis_ping_url

examples/run_examples.py:251–262  ·  view source on GitHub ↗
(url: str, timeout: float = 0.5)

Source from the content-addressed store, hash-verified

249
250
251def redis_ping_url(url: str, timeout: float = 0.5) -> bool:
252 host_port = redis_url_host_port(url)
253 if host_port is None:
254 return False
255 host, port = host_port
256 try:
257 with socket.create_connection((host, port), timeout=timeout) as sock:
258 sock.settimeout(timeout)
259 sock.sendall(b"*1\r\n$4\r\nPING\r\n")
260 return sock.recv(16).startswith(b"+PONG")
261 except OSError:
262 return False
263
264
265def truthy_env_value(value: str | None) -> bool:

Callers 2

Calls 3

redis_url_host_portFunction · 0.85
sendallMethod · 0.80
recvMethod · 0.45

Tested by

no test coverage detected