Spaces:
Sleeping
Sleeping
File size: 574 Bytes
e272f4f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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.") |