Spaces:
Sleeping
Sleeping
| import socket | |
| from qdrant_client import QdrantClient | |
| def check_port(host, port): | |
| with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
| return s.connect_ex((host, port)) == 0 | |
| host = "localhost" | |
| port = 6333 | |
| if check_port(host, port): | |
| print(f"Port {port} is open. Testing Qdrant API...") | |
| try: | |
| client = QdrantClient(host=host, port=port) | |
| print("Success! Collections:", client.get_collections()) | |
| except Exception as e: | |
| print(f"API Error: {e}") | |
| else: | |
| print(f"ERROR: Port {port} is closed. Check if Qdrant is running.") |