File name
Commit message
Commit date
후처리 모듈 및 메인 서버 전달을 위한 수정 1. ITS cctv 스트리밍 정보를 하나의 프로세스가 하나의 영상을 담당하여 처리 및 실행하기 위한 스크립트와 bash 스크립트 2. FrameCapturer 객체에 위경도 정보 필수 arg
05-20
note to myself : http headers does not use '_', and will be converted into '-', and by convention, should use captical letter at the first letter of each words.
05-24
import requests
import time
# Base URL for the server
BASE_URL = 'http://localhost:5000/status'
# Function to send a POST request with status data
def send_status(source, status):
response = requests.post(BASE_URL, json={"source": source, "status": status})
print(f"Sent {status} for {source}, Response: {response.json()}")
# Function to test normal and force send modes for multiple sources
def test_server():
sources = ['source1', 'source2', 'source3', 'source4', 'source5']
# Scenario 1: Normal behavior with source1
print("\nScenario 1: Normal behavior with source1")
for _ in range(4):
send_status('source1', 'OK')
for _ in range(5):
send_status('source1', 'FAIL')
for _ in range(10):
send_status('source1', 'OK')
for _ in range(10):
send_status('source1', 'OK')
# Scenario 2: Force send and revert with source2
print("\nScenario 2: Force send and revert with source2")
for _ in range(5):
send_status('source2', 'FAIL')
for _ in range(10):
send_status('source2', 'OK')
for _ in range(10):
send_status('source2', 'OK')
# Scenario 3: Random mix with source3
print("\nScenario 3: Random mix with source3")
mix = ['OK', 'FAIL', 'OK', 'FAIL', 'OK', 'FAIL', 'OK', 'OK', 'OK', 'OK']
for status in mix:
send_status('source3', status)
for _ in range(5):
send_status('source3', 'FAIL')
for _ in range(10):
send_status('source3', 'OK')
# Scenario 4: Source4 fails and recovers
print("\nScenario 4: Source4 fails and recovers")
for _ in range(5):
send_status('source4', 'FAIL')
for _ in range(10):
send_status('source4', 'OK')
for _ in range(10):
send_status('source4', 'OK')
# Scenario 5: Source5 normal operation
print("\nScenario 5: Source5 normal operation")
for _ in range(10):
send_status('source5', 'OK')
for _ in range(10):
send_status('source5', 'OK')
if __name__ == '__main__':
# Give some time for the server to start
time.sleep(2)
test_server()