Files
Brancheneinstufung2/ARCHIVE_legacy_scripts/test_explorer_connection.py

32 lines
995 B
Python

import requests
import os
from requests.auth import HTTPBasicAuth
def test_connection(url, name):
print(f"--- Testing {name}: {url} ---")
try:
# We try the health endpoint
response = requests.get(
f"{url}/health",
auth=HTTPBasicAuth("admin", "gemini"),
timeout=5
)
print(f"Status Code: {response.status_code}")
print(f"Response: {response.text}")
return response.status_code == 200
except Exception as e:
print(f"Error: {e}")
return False
# Path 1: Hardcoded LAN IP through Proxy
url_lan = "http://192.168.178.6:8090/ce/api"
# Path 2: Internal Docker Networking (direct)
url_docker = "http://company-explorer:8000/api"
success_lan = test_connection(url_lan, "LAN IP (Proxy)")
print("\n")
success_docker = test_connection(url_docker, "Docker Internal (Direct)")
if not success_lan and not success_docker:
print("\nFATAL: Company Explorer not reachable from this container.")