DslrDirector/test_server.py
2025-09-29 00:46:38 -07:00

23 lines
812 B
Python

import requests
import time
# Give the server a moment to start if needed
time.sleep(1)
# Test the server with a GET request
try:
print("Testing server with GET request...")
response = requests.get("http://127.0.0.1:8090/?event_type=session_start&param1=PrintAndGIF", timeout=5)
print(f"Status Code: {response.status_code}")
print(f"Response: {response.text}")
# Test another request
print("\nTesting another request...")
response2 = requests.get("http://127.0.0.1:8090/?event_type=countdown&param1=30", timeout=5)
print(f"Status Code: {response2.status_code}")
print(f"Response: {response2.text}")
except requests.exceptions.ConnectionError:
print("Could not connect to the server. Is it running on port 8090?")
except Exception as e:
print(f"Error: {e}")