| import requests | |
| import json | |
| import socket | |
| COMFY_URL = "http://127.0.0.1:8188" | |
| def check_comfy(): | |
| print(f"Checking ComfyUI at {COMFY_URL}...") | |
| try: | |
| response = requests.get(f"{COMFY_URL}/system_stats", timeout=5) | |
| if response.status_code == 200: | |
| print("Successfully connected to ComfyUI!") | |
| print(json.dumps(response.json(), indent=2)) | |
| return True | |
| else: | |
| print(f"ComfyUI returned status code: {response.status_code}") | |
| except requests.exceptions.ConnectionError: | |
| print("Error: Could not connect to ComfyUI. Is it running?") | |
| except Exception as e: | |
| print(f"An unexpected error occurred: {e}") | |
| return False | |
| if __name__ == "__main__": | |
| check_comfy() | |