import requests
import random
import json

ports = []
# transaction hub in
ports.extend(range(30001, 30003))
# data hub
ports.extend(range(30101, 30110))
# transaction hub out
ports.extend(range(30201, 30205))

print(f"Checking {len(ports)} ports")


home_url = 'http://143.205.173.36:{port}/'
debug_url = home_url + 'api/debug'
print(debug_url)

for port in ports:
    response = requests.get(home_url.replace("{port}", str(port)))
    print(response.text)

    data = {'data': f"Echo {str(random.random())}"}    
    response = requests.post(debug_url.replace("{port}", str(port)), json=data)
    print(response.text)