import requests import json # Configuration BASE_URL = "https://dev-api.oneskyit.com/agent" def get_headers(): headers = { "Content-Type": "application/json", "X-No-Account-ID": "testing-bypass" } return headers def test_endpoint(method, path, description, params=None): """ Helper to run a test and print results. """ print(f"--- Testing: {description} ---") url = f"{BASE_URL}{path}" request_headers = get_headers() try: if method == "GET": response = requests.get(url, headers=request_headers, params=params) print(f"URL: {response.url}") print(f"Status Code: {response.status_code}") data = response.json() # Check if the result is a list or single object result_data = data.get('data') if isinstance(result_data, dict): print(f"Result Data: {json.dumps(result_data, indent=2)}") else: print(f"Result Data (truncated): {str(result_data)[:200]}...") if response.status_code != 200: print(f"Error Message: {data.get('status_message')}") except Exception as e: print(f"Error during test: {e}") print("-" * 40 + "\n") if __name__ == "__main__": print(f"Starting Aether Agent Bridge Tests against {BASE_URL}\n") # 1. Get Status test_endpoint("GET", "/status", "Get Container Status") # 2. Get Logs (last 5 lines) test_endpoint("GET", "/logs", "Get Latest Logs", params={"lines": 5}) print("Tests Complete.")