Files
railseek6/check_endpoints.py

42 lines
1.3 KiB
Python

import requests
import json
try:
# Get the OpenAPI spec
r = requests.get('http://localhost:3015/docs')
print(f"Status: {r.status_code}")
print(f"Content length: {len(r.text)}")
# Try to parse as JSON
try:
data = json.loads(r.text)
print("\nAvailable endpoints:")
paths = data.get('paths', {})
for path, methods in paths.items():
print(f"{path}: {list(methods.keys())}")
except json.JSONDecodeError:
print("Response is not valid JSON, showing raw content:")
print(r.text[:500])
# Try common search endpoints
print("\nTesting common search endpoints:")
search_endpoints = [
'/search',
'/api/search',
'/query',
'/api/query',
'/rag/search',
'/api/rag/search'
]
for endpoint in search_endpoints:
try:
test_response = requests.post(f'http://localhost:3015{endpoint}', json={'query': 'test'})
print(f"{endpoint}: {test_response.status_code}")
if test_response.status_code != 404:
print(f" Response: {test_response.text[:200]}")
except Exception as e:
print(f"{endpoint}: Error - {e}")
except Exception as e:
print(f"Error: {e}")